this script works perfectly in studio, but when i test on a server. Whats wrong with it?
game.Players.PlayerAdded:connect(function(player)
local leaderstat = Instance.new("Model")
leaderstat.Parent = player
leaderstat.Name = "leaderstats"
local ROBUX = Instance.new("IntValue")
ROBUX.Name = "CashDonated"
ROBUX.Parent = game.Players.LocalPlayer.leaderstats
ROBUX.Value = 0
local PlayTime = Instance.new("IntValue")
PlayTime.Parent = leaderstat
PlayTime.Value = 0
PlayTime.Name = "Play Time"
local i = 0
while true do
i = i + 1
PlayTime.Value = i
wait(1)
end
end)

2 comments
You can't use LocalPlayer in a Server Script, and leaderstats are kind of need to be run in a Server Script... Line 9, all you need is ROBUX.Parent = leaderstat
You can also set a parent without setting it like .Parent by putting it after the instance name with a coma. In this case: Instance.new("IntValue", leaderstat), the leaderstat was already assigned parent to the player, so you could've assigned it to that instead.