The code:
function addcash(cash) game.Players.PlayerAdded:Connect(function(plr) plr.leaderstats.Cash += cash end) end script.Parent.ClickDetector.MouseClick:Connect(addcash(10))
Error: Attempt to connect failed: Passed value is not a function
You do not need to make separate function for playeradded
can you try this?
script.Parent.ClickDetector.MouseClick:Connect(function(plr) plr.leaderstats.Cash += --Put any amount of cash you want-- end)
have not tested code, tell me if there is any small error