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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Help! Mass server heal needed!

Previous Thread :: Next Thread 
WingedAbaddon is not online. WingedAbaddon
Joined: 23 Aug 2012
Total Posts: 93
31 Dec 2014 12:36 AM
Okay, so, what im trying to do is heal everyone in the server after a short script. But the problem is i don't know how to make everyone in the game into one variable, then healing them all.

while true do
local v = game.Players:GetChildren()-ik this part is wrong but how do i write it correctly
v.Humanoid.Torso.MaxHealth = math.huge
wait(0.5)
end


Im stuck on getting everyone in the server into one variable! Please help. (If you want to put non-helping comments, pm me instead, and i'll reply there. This is only for helping :/)
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
31 Dec 2014 12:37 AM
use this

for i,v in pairs(game.Players:GetChildren()) do
if v.Character then --This is so if a player is still loading in it wont break
v.Character.Humanoid.Health = v.Character.Humanoid.MaxHealth
end
end
Report Abuse
warriorqaz is not online. warriorqaz
Joined: 09 Oct 2009
Total Posts: 726
31 Dec 2014 12:43 AM
Just to be safe, you should also make sure the humanoid exists and it is not dead.
Report Abuse
WingedAbaddon is not online. WingedAbaddon
Joined: 23 Aug 2012
Total Posts: 93
31 Dec 2014 03:14 AM
Didn't work. I think something went wrong with the players part. Okay, let's make it simple.
while true do
game.Workspace.WingedAbaddon.Humanoid.MaxHealth = math.huge
wait(0.1)
end

^^ now instead of just healing me, how could you just heal everyone? The script didn't work because it said "Humanoid is not a valid property of Players" or something like that.

while true do
for i,v in pairs(game.Players:GetChildren())
v.Workspace.Humanoid.MaxHealth = math.huge
wait(0.1)
end
end

For some reason that wont work, local or not local.
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
31 Dec 2014 03:16 AM
for _,plr in pairs(game.Players:GetPlayers()) do
if plr.Character and plr.Character.Humanoid then
plr.Character.Humanoid.Health = 0
end
end

there is no need to use while loop with it, for is a loop itself
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
31 Dec 2014 03:19 AM
never used but

for _,v in pairs(workspace:GetChildren()) do
if game.Players:GetPlayerFromCharacter(v) and v:FindFirstChild("Humanoid") then -- wow i didnt use findfirstchild for humanoid in last post, whatever i think its there always until someone removes it
v.Humanoid.Health = v.Humanoid.MaxHealth
end
end
Report Abuse
Egzekiel is not online. Egzekiel
Joined: 10 Jan 2011
Total Posts: 1079
31 Dec 2014 04:22 AM
^ You complicate yourself too much
local peeps=game.Players:GetChildren()
for _,v in ipairs(peeps) do
if v.Character~=nil then
if v.Character.Humanoid.Health>0 then
v.Character.Humanoid.Health=v.Character.Humanoid.MaxHealth
end
end
end
Report Abuse
Egzekiel is not online. Egzekiel
Joined: 10 Jan 2011
Total Posts: 1079
31 Dec 2014 04:22 AM
Error, pairs instead of ipairs.
Report Abuse
WingedAbaddon is not online. WingedAbaddon
Joined: 23 Aug 2012
Total Posts: 93
31 Dec 2014 10:31 PM
ty lol XD
Report Abuse
WingedAbaddon is not online. WingedAbaddon
Joined: 23 Aug 2012
Total Posts: 93
31 Dec 2014 10:32 PM
and thank you to those 2 others for the help
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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