What I am trying to do is make a command which opens a gui that displays how long you’ve been in the server!
Pls help me i’ve searched far and wide.
I have the gui and command just the time of how long they’ve been in server won’t work.
I’ve looked everywhere to find this and i just cant ive been looking for literally three days
Yes, I can help you with that. Here’s an example code that you can use:
local Players = game:GetService("Players")
local function GetPlayerTime(player)
-- Get the current time and the time the player joined
local currentTime = tick()
local joinTime = player.TimeStamp
-- Calculate the time the player has spent in the server
return currentTime - joinTime
end
-- Create the command
game:GetService("ReplicatedStorage").cmds.GetTime.OnServerInvoke = function(player)
local timeInServer = GetPlayerTime(player)
return timeInServer
end
You can customize this code to fit your needs on how you want to display the time in the GUI.