How would i paste this on surface GUI? And data store it?
-- script, ServerScriptService
game.Players.PlayerAdded:Connect(function(player) -- when player joins
local leaderstats = Instance.new("IntValue", player) -- makes leaderstats
leaderstats.Name = "leaderstats" -- dont change the name of it
local timeSpent = Instance.new("IntValue", leaderstats) -- makes stat for most time played
timeSpent.Name = "Time Wasted" -- name of stat (if your game is waste of time then why do you make it?)
while true -- makes loop
do timeSpent.Value = timeSpent.Value + 1 -- adds 1 value
wait(1) -- per second
end
end)
