Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years 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 2 years ago

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

0
This issue is happening again how can I solve the problem Coolmansunsh 26 — 2y
Ad

Answer this question