|
| 31 Jul 2011 01:30 AM |
I have just started scripting. I made a script and I can't figure whats wrong with it! Help?
for q=1,5000 if game.Workspace.scoutywouty.Humanoid.Health = 0 then players = game.Players for i=1, #players do game.Players.players[i].Character.Humanoid.Health = 0 wait(2) end end end end end --Never be too carefull
I want it to kill everyone if I die. Help? |
|
|
| Report Abuse |
|
|
| |
|
pokesal
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 10751 |
|
|
| 31 Jul 2011 01:40 AM |
| Maybe you have too many ends. I'm not sure though. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2011 01:42 AM |
| I changed it to one end. Still doesn't work. |
|
|
| Report Abuse |
|
|
pokesal
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 10751 |
|
|
| 31 Jul 2011 01:44 AM |
| I think it needs four ends. I am testing. |
|
|
| Report Abuse |
|
|
WishNite
|
  |
| Joined: 11 Feb 2009 |
| Total Posts: 15828 |
|
|
| 31 Jul 2011 01:45 AM |
repeat wait() until game.Players:findFirstChild("scoutywouty") --Self explanatory for q=1,5000 do --forgot the "do" if game.Workspace.scoutywouty.Humanoid.Health == 0 then --You need two equal signs for if statements. players = game.Players:GetChildren() --You need to make players into a table for i=1, #players do game.Players[i].Character.Humanoid.Health = 0 --not sure about this line. wait(2) end end end --end--One extra end will break your script.
Problems:
You have to use two equal signs. == means equals to, = means setting the value of something
Use output for errors.
If this doesn't work, I am 95% sure it's the for line. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2011 01:45 AM |
| Doesn't work with 4 ends either. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2011 01:47 AM |
| Thank you! I forgot findfirstchild and getchildren! |
|
|
| Report Abuse |
|
|
| |
|
pokesal
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 10751 |
|
|
| 31 Jul 2011 01:54 AM |
game.Players[i].Character.Humanoid.Health == 0
That line needs two equal signs as shown above if I am not mistaken. |
|
|
| Report Abuse |
|
|
WishNite
|
  |
| Joined: 11 Feb 2009 |
| Total Posts: 15828 |
|
|
| 31 Jul 2011 02:00 AM |
This works.
repeat wait() until game.Players:findFirstChild("scouty") while true do if game.Workspace.scoutywouty.Humanoid.Health == 0 then players = game.Players:GetChildren() for i=1, #players do players[i].Character.Humanoid.Health = 0 wait(2) end wait() end end |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 31 Jul 2011 02:47 AM |
Your original code had WAY too many ends.
Pro Tip: Use events instead of infinite loops where applicable.
game.PlayerAdded:connect(function(plr) if plr.Name == "YOUR_NAME_HERE" then -- obvious edit required here. plr.Character.Died:connect(function() for i, v in pairs(game.Players:getChildren()) do if v ~= plr then v.Character:BreakJoints() end end end) else return end end)
______________________________________ ~pwnedu46~ -I lost the game.-
|
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 31 Jul 2011 02:49 AM |
oops! fix:
game.PlayerAdded:connect(function(plr) if plr.Name == "YOUR_NAME_HERE" then -- obvious edit required here. plr.Character.Humanoid.Died:connect(function() for i, v in pairs(game.Players:getChildren()) do if v ~= plr then v.Character:BreakJoints() end end end) else return end end)
______________________________________ ~pwnedu46~ -I lost the game.-
|
|
|
| Report Abuse |
|
|
|
| 31 Jul 2011 03:12 AM |
| What do you need help with? |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2011 04:16 AM |
workspace.ScoutyWouty.Humanoid.Died:connect(function() for _,v in pairs(game.Players:children()) do v.Character:BreakJoints() end end) |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2011 06:58 AM |
| I lol'd at the people who tried to fix it |
|
|
| Report Abuse |
|
|