generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Newbie scripter help?

Previous Thread :: Next Thread 
scoutywouty is not online. scoutywouty
Joined: 30 May 2009
Total Posts: 5181
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
scoutywouty is not online. scoutywouty
Joined: 30 May 2009
Total Posts: 5181
31 Jul 2011 01:35 AM
Please?
Report Abuse
pokesal is not online. 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
scoutywouty is not online. scoutywouty
Joined: 30 May 2009
Total Posts: 5181
31 Jul 2011 01:42 AM
I changed it to one end. Still doesn't work.
Report Abuse
pokesal is not online. 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 is not online. 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
scoutywouty is not online. scoutywouty
Joined: 30 May 2009
Total Posts: 5181
31 Jul 2011 01:45 AM
Doesn't work with 4 ends either.
Report Abuse
scoutywouty is not online. scoutywouty
Joined: 30 May 2009
Total Posts: 5181
31 Jul 2011 01:47 AM
Thank you! I forgot findfirstchild and getchildren!
Report Abuse
scoutywouty is not online. scoutywouty
Joined: 30 May 2009
Total Posts: 5181
31 Jul 2011 01:48 AM
Still doesn't work -.-
Report Abuse
pokesal is not online. 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 is not online. 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 is not online. 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 is not online. 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
Brandonroblox is not online. Brandonroblox
Joined: 14 Oct 2008
Total Posts: 1673
31 Jul 2011 03:12 AM
What do you need help with?
Report Abuse
UttermostExedra is not online. UttermostExedra
Joined: 28 Dec 2009
Total Posts: 2483
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
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
31 Jul 2011 06:58 AM
I lol'd at the people who tried to fix it
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image