✓ Accepted answer
I think what you're asking is a leaderboard system.
with this way you could check how long a player is on the server this session and how much gold he has.
Example leaderboard
local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 0
gold.Parent = leaderstats
local.time = Instance.new("IntValue")
time.Name = "Time"
time.Value = 0
time.Parent = leaderstats
end
With this you have a folder in each Player with 2 Stats called gold and time. Now you could also do an easy function to make the IntValue in Time go up 1 every second.
If you do that you can check with print how long the player is on the server or make a GUI and display it there. I just gave you the beginning.
Example of Time Function
while true do
wait(1)
time.Value = time.Value + 1
end
(I dont know if this works, Roblox is down right now)
But if this works you need to place it in the same script, right under my Lines up there.
4 comments
r u gonna use data store to save the amount of gold?
also to get a player variable u need to do game.Players.LocalPlayer (only in local scripts because a server script isn't used to find specific player values)
??*
This doesn't make a lick of sense.