Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Workspace.Maps.DesertMap.Door.Script:5: attempt to index nil with 'leaderstats'?

What does the error mean??

script.Parent.Touched:Connect(function(hit)
	
	if hit then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player.leaderstats.Coin.Value >= script.Parent.Requirement.Value then
			player.leaderstats.Coin.Value -= script.Parent.Requirement.Value
			for i,v in pairs(workspace.Maps.DesertMap:GetChildren()) do
				v.Transparency = 0.75
				v.CanCollide = false
			end
			
			if player.leaderstats.Coin.Value < script.Parent.Requirement.Value then
				player.PlayerGui.Status.NotEnoughMoney.Visible = true
				wait(1)
				player.PlayerGui.Status.NotEnoughMoney.Visible = false
	   end
	end
 end
end)

1 answer

✓ Accepted answer

The error means that the script is trying to index something that does not exist.

1 comment

0

This issue is happening again how can I solve the problem

This discussion is preserved as it was. New answers, comments, and votes are closed.