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

The script is not running the code if the value is correct?

Asked by 3 years ago
for i,v in pairs(workspace.Levels:GetChildren()) do

    if v.ClassName == "Part" then

        v.Touched:Connect(function(object)
            local d = object.Parent:FindFirstChild("Humanoid")
            if d then
                local player = game.Players:GetPlayerFromCharacter(object.Parent)
                if v.Name == "Level1" then
                    if player.leaderstats.Levels.Value == 0 then
                        SetCheckpoint(player,v)
                        print("set checkpoint")
                    end
                end
                if v.Name == "Level2" then
                    if player.leaderstats.Levels.Value == 1 then
                        SetCheckpoint(player,v)
                        print("set checkpoint")
                    end
                end
            end
        end)
    end
end

So I am trying to check if the Levels.Value for the player is equal to what I entered but when I test the script and the Levels.Value for the player is the same nothing is happening and the function SetCheckpoint is not working.

1
Can you post a screenshot of your explorer tab? davidladmuta 71 — 3y

Answer this question