|
| 17 Sep 2015 08:40 PM |
Having trouble with this piece of script:
chest.open.Metal.Transparency = 0 chest.open.Metal.CanCollide = true chest.open.Wood.Transparency = 0 chest.open.Wood.CanCollide = true chest.open.Key.Transparency = 0 chest.closed.Metal.Transparency = 1 chest.closed.Metal.CanCollide = false chest.closed.Wood.Transparency = 1 chest.closed.Wood.CanCollide = false chest.closed.Key.Transparency = 1 chest["You already got your award"].Head.Position = Vector3.new(-113.946, 47.358, -394.414) local players = game.Players:children() for i = 1, #players do if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.Gold ~= nil) then players[i].leaderstats.Gold.Value = 0 end for i = 1,#workspace:GetChildren() do pcall(function() workspace:GetChildren()[i].Humanoid.Health = 0 end) end wait(1) greenscore.Value = 0 redscore.Value = 0 wait(5) chest.open.Metal.Transparency = 1 chest.open.Metal.CanCollide = false chest.open.Wood.Transparency = 1 chest.open.Wood.CanCollide = false chest.open.Key.Transparency = 1 chest.closed.Metal.Transparency = 0 chest.closed.Metal.CanCollide = true chest.closed.Wood.Transparency = 0 chest.closed.Wood.CanCollide = true chest.closed.Key.Transparency = 0 chest["You already got your award"].Head.Position = Vector3.new(0, -10, 0) end end end
The chest parts are changed the first time, and the position is altered. Also, the score values are updated. However, in the lines right after, where I am attempting to reverse what was done to the chest in the first half, nothing happens! What's the difference between the bottom chest changes and the top? Especially since the score.Values right before the wait(5) are being updated D: |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 17 Sep 2015 11:15 PM |
Update: It seems if I remove the small section that kills all humanoids, the second chest part works... But I can't figure out why. Here's the full script. Please help :( (Oh, and I moved an end around)
local greenscore = game.Workspace.FLAGSYSTEM.GreenScore local redscore = game.Workspace.FLAGSYSTEM.RedScore local hollowflag = game.Workspace.FLAGSYSTEM.Hollow.Part local islandflag = game.Workspace.FLAGSYSTEM.Island.Part local peakflag = game.Workspace.FLAGSYSTEM.Peak.Part local hollowtop = game.Workspace.FLAGSYSTEM.Hollow.Flag local islandtop = game.Workspace.FLAGSYSTEM.Island.Flag local peaktop = game.Workspace.FLAGSYSTEM.Peak.Flag local music = script.Parent.Parent.Win local chest = game.Workspace.GreenTreasure
while wait() do -- This will repeat it forever and ever. repeat -- Changed to repeat, for reasons. wait(2) print("The games continue") until greenscore.Value >= 500 do script.Parent.Visible = true print("The games complete") music:play() wait() music:stop() music:play() hollowflag.BrickColor = BrickColor.new(1) islandflag.BrickColor = BrickColor.new(1) peakflag.BrickColor = BrickColor.new(1) hollowtop.BrickColor = BrickColor.new(1) islandtop.BrickColor = BrickColor.new(1) peaktop.BrickColor = BrickColor.new(1) chest.open.Metal.Transparency = 0 chest.open.Metal.CanCollide = true chest.open.Wood.Transparency = 0 chest.open.Wood.CanCollide = true chest.open.Key.Transparency = 0 chest.closed.Metal.Transparency = 1 chest.closed.Metal.CanCollide = false chest.closed.Wood.Transparency = 1 chest.closed.Wood.CanCollide = false chest.closed.Key.Transparency = 1 chest["You already got your award"].Head.Position = Vector3.new(-113.946, 47.358, -394.414) local players = game.Players:children() for i = 1, #players do if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.Gold ~= nil) then players[i].leaderstats.Gold.Value = 0 end end for i = 1,#workspace:GetChildren() do pcall(function() workspace:GetChildren()[i].Humanoid.Health = 0 end) end wait(1) greenscore.Value = 0 redscore.Value = 0 wait(5) chest.open.Metal.Transparency = 1 chest.open.Metal.CanCollide = false chest.open.Wood.Transparency = 1 chest.open.Wood.CanCollide = false chest.open.Key.Transparency = 1 chest.closed.Metal.Transparency = 0 chest.closed.Metal.CanCollide = true chest.closed.Wood.Transparency = 0 chest.closed.Wood.CanCollide = true chest.closed.Key.Transparency = 0 chest["You already got your award"].Head.Position = Vector3.new(0, -10, 0) end end
|
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 11:27 PM |
| WHAT IS THIS? If I remove the wait(5) near the end of the script, it all works... WHY?!? |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 11:30 PM |
| If I add a wait(3) instead it works........ |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 11:31 PM |
| But wait(4) is too much apparently. Okay I'm so stuck. |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 11:34 PM |
| RemindMe! 12 hours "shorten this up" |
|
|
| Report Abuse |
|
|