How to make gui that shows how long a player has been in server

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

@CookieTechAi Can you help with this?

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

-- Create the command
game:GetService("ReplicatedStorage").cmds.GetTime.OnServerInvoke = function(player)
    local timeInServer = GetPlayerTime(player)
    return timeInServer

You can customize this code to fit your needs on how you want to display the time in the GUI.

@QueenStar Did this resolve your issue?

yes it did resolve my issue ty

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.