I am making a script where when I touch a part it changes other part's properties, then it is meant to change my leaderstats Stage Value to 1 if it is on 0 else do nothing, after that is some more propertie changing.
game:WaitForChild("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")
game.Workspace.Enemies.Dark.Zombie.WalkSpeed = 0
end
end
end
end)
end)

3 comments
The leaderstat part isn't working
Try to pinpoint exactly what part of the script isn't working by adding print statement at certain parts - is the Part.Touched event even firing? any errors? be more specific in what is not working
The Part touched is working, everyhing is working except the leaderstat changing