I am making a simulator and i stumbled upon this problem that I can't fix and it says: Workspace.Coin.Script:4: attempt to index nil with 'leaderstats' so I came here. I hope you can answer my question!
local rc = 10
local debounce = true script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid")then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player.leaderstats.Cash.Value >= rc then if debounce then debounce = false script.Parent.Transparency = 0.5 script.Parent.CanCollide = false if rc.Value <= rc then script.Parent.Transparency = 0.15 script.DesertDoor1.CanCollide = true end end end end end)
Workspace.Coin.Script:4: attempt to index nil with 'leaderstats

2 comments
use code blocks pls
I'm Sorry But I Don't Know What A Code Block Is..... Sorry :(