Why are you cloning this here? Try replacing it with something like this:
local Money = Instance.new("IntValue")
Money.Parent = plr
Also, you don’t need a LocalScript to access leaderstats, I would do:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(plr)
local Money = Instance.new("IntValue")
Money.Parent = plr
while task.wait(3) do
Money.Value += 5
end
end)
I’m not doing leaderstats, the value in the player is the money.
(I’m also trying to do the clock on the local script because that way for every 10 seconds the player joins it gets the money instead of every 10 seconds in the server.
If you do it client-sided (in a local script), then you will only be able to read it client-sidedly and not server-sidedly.
Instead have the server-script include it like so:
game:GetService("Players").PlayerAdded:Connect(function(player)
local playerMoney = script.Parent.Money:Clone()
playerMoney.Parent = player
while true do wait(3)
playerMoney.Value += 5
end
end)
As well as using a RemoteEvent to add money could be exploited, so I removed that.
Edit: Fixed playerMoney.Value += 5 I wrote Money.Parent = player & the following:
Including that I suggest instead of using :Clone() to make an Instance yourself, as clone could fail if the MoneyValue would be deleted.
So instead you could do either:
local playerMoney = Instance.new("IntValue")
playerMoney.Value = 100 -- starter value
or
local playerMoney = Instance.new("NumberValue")
playerMoney.Value = 100 -- starter value