Good morning, everyone, So I'm making a tycoon and I want when I pass on the collector, to get the money back so I made this script:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + script.Parent.Parent.Screen.amount.Value
end
end)
And when I run the script I get the following error: "attempt to index field'LocalPlayer' (a nil value)", I looked on other forums but nothing, I don't know what to do. Help me please

1 comment
You cant use game.Players.LocalPlayer on a server script