i got this error when i collect the coins around my map
17:05:11.658 - Workspace.Map1.Coins.Part.Script:4: attempt to index nil with 'leaderstats' 17:05:11.659 - Stack Begin 17:05:11.659 - Script 'Workspace.Map1.Coins.Part.Script', Line 4 17:05:11.660 - Stack End
script.Parent.Touched:Connect(function(hit) local player = hit.Parent:FindFirstChild("Humanoid") local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr.leaderstats.Cash.Value >= 0 then wait() script.Disabled = true script.Parent.Transparency = 1 script.Parent.CanCollide = false plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 1 wait(5) script.Parent.Transparency = 0 script.Parent.CanCollide = true script.Disabled = false end end)
i frequently get this error everytime i collect the coins but it doesnt affect my game. I would appreciate your solution for this. Thankyou!