Ad
Log in to vote
0

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

Asked by 9 days ago

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

Log in to vote
0
Answered by 6 days ago

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

Ad

Answer this question