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

1if plr.leaderstats.Stage >=1 then
2 
3 
4else
5    plr.leaderstats.Stage = 1  
6    end

Total Script

01game.Players.PlayerAdded:Connect(function(plr)
02    script.Parent.Touched:Connect(function(hit)
03        if game.Players:GetPlayerFromCharacter(hit.Parent) then
04            if workspace:FindFirstChild("Walls", true) then
05                local wall = workspace.Walls:FindFirstChild("Wall4", true)
06                wall.CanCollide = true
07                wall.BrickColor = BrickColor.new("Really red")
08                script.Parent.CanCollide = false
09                script.Parent.BrickColor = BrickColor.new("Really red")
10game.ReplicatedStorage.NightSky.Parent = game.Lighting
11           if plr.leaderstats.Stage >=1 then
12 
13 
14else
15    plr.leaderstats.Stage = 1  
View all 28 lines...

2 answers

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

I think you forgot .Value at the end

1if plr.leaderstats.Stage.Value >=1 then
2 
3 
4else
5    plr.leaderstats.Stage.Value = 1  
6    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.

01game.Players.PlayerAdded:Connect(function(plr)
02    script.Parent.Touched:Connect(function(hit)
03        if game.Players:GetPlayerFromCharacter(hit.Parent) then
04            if workspace:FindFirstChild("Walls", true) then
05                local wall = workspace.Walls:FindFirstChild("Wall4", true)
06                wall.CanCollide = true
07                wall.BrickColor = BrickColor.new("Really red")
08                script.Parent.CanCollide = false
09                script.Parent.BrickColor = BrickColor.new("Really red")
10                game.ReplicatedStorage.NightSky.Parent = game.Lighting
11 
12                if (plr.leaderstats.Stage.Value <= 0) then
13                    plr.leaderstats.Stage.Value = 1
14                else
15 
View all 27 lines...
0
that doesn't work zomspi 541 — 5y

Answer this question