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

Leaderstats are not being changed?

Asked by
zomspi 541 Moderation Voter
5 years ago

My script to change leaderstats isn't working, this is 1 part of a big script.

Issue

if plr.leaderstats.Stage >=1 then


else
    plr.leaderstats.Stage = 1   
    end 

Total Script

game.Players.PlayerAdded:Connect(function(plr)
    script.Parent.Touched:Connect(function(hit)
        if game.Players:GetPlayerFromCharacter(hit.Parent) then
            if workspace:FindFirstChild("Walls", true) then
                local wall = workspace.Walls:FindFirstChild("Wall4", true)
                wall.CanCollide = true
                wall.BrickColor = BrickColor.new("Really red")
                script.Parent.CanCollide = false
                script.Parent.BrickColor = BrickColor.new("Really red")
game.ReplicatedStorage.NightSky.Parent = game.Lighting
           if plr.leaderstats.Stage >=1 then


else
    plr.leaderstats.Stage = 1   
    end 
wait(15)
if workspace:FindFirstChild("Walls", true) then
    local Wall1 = workspace.Walls:FindFirstChild("Wall5", true)
    Wall1.CanCollide = false
    Wall1.BrickColor = BrickColor.new("Lime green")

end
end
end
end)
end)
            -- Your other function would go here






2 answers

Log in to vote
1
Answered by
NSMascot 113
5 years ago

I think you forgot .Value at the end

if plr.leaderstats.Stage.Value >=1 then


else
    plr.leaderstats.Stage.Value = 1   
    end 
0
ahh thx zomspi 541 — 5y
0
it still doesn't work though, when I touch the part with 0 as the Stage it stays at 0 instead of changing to 1 zomspi 541 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

See if this works.

game.Players.PlayerAdded:Connect(function(plr)
    script.Parent.Touched:Connect(function(hit)
        if game.Players:GetPlayerFromCharacter(hit.Parent) then
            if workspace:FindFirstChild("Walls", true) then
                local wall = workspace.Walls:FindFirstChild("Wall4", true)
                wall.CanCollide = true
                wall.BrickColor = BrickColor.new("Really red")
                script.Parent.CanCollide = false
                script.Parent.BrickColor = BrickColor.new("Really red")
                game.ReplicatedStorage.NightSky.Parent = game.Lighting

                if (plr.leaderstats.Stage.Value <= 0) then
                    plr.leaderstats.Stage.Value = 1
                else

                end

                wait(15)
                if workspace:FindFirstChild("Walls", true) then
                     local Wall1 = workspace.Walls:FindFirstChild("Wall5", true)
                     Wall1.CanCollide = false
                     Wall1.BrickColor = BrickColor.new("Lime green")
                end
            end
        end
    end)
end)

0
that doesn't work zomspi 541 — 5y

Answer this question