|
| 29 Aug 2014 11:53 PM |
I want it to choose a random play and give it 150 health and 20 walkspeed. Im pretty sure this is the part of the script that needs fixing.
-- Created by eminem4roblox
p = game.Players:Children() crimonal = p[math.random(1,#p)] -- Get's a random player
wait(1) print ("Crimonal has been chosen!")
crimonal.Humanoid.Health = 150 crimonal.Humanoid.MaxHealth = 150 crimonal.Humanoid.WalkSpeed = 20
print ("Crimonal has been given powers!") |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
|
| 29 Aug 2014 11:55 PM |
First :Children() is deprecated Use :GetPlayers() or :GetChildren() Then tell us what the output says |
|
|
| Report Abuse |
|
|
jknite
|
  |
| Joined: 30 Nov 2007 |
| Total Posts: 614 |
|
|
| 29 Aug 2014 11:56 PM |
p = game.Players:GetChildren() -- forgot get crimonal = p[math.random(1,#p)] -- Get's a random player -- I haven't used this method for it, but seems like it should work
wait(1) print ("Crimonal has been chosen!")
crimonal.Humanoid.Health = 150 crimonal.Humanoid.MaxHealth = 150 crimonal.Humanoid.WalkSpeed = 20
print ("Crimonal has been given powers!") |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2014 11:57 PM |
Still doesn't work. The output is:
00:57:13.299 - Auto-Saving... 00:57:15.146 - Workspace.Script:4: bad argument #2 to 'random' (interval is empty) 00:57:15.148 - Script 'Workspace.Script', Line 4 00:57:15.150 - Stack End |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
| |
|
oatsssss
|
  |
| Joined: 31 Jul 2014 |
| Total Posts: 170 |
|
|
| 30 Aug 2014 12:12 AM |
If this is a script that runs at launch, add this to the beginning:
repeat wait() until #game.Players:GetChildren() > 0 |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2014 07:51 AM |
Okay so now it says crimonal has been chosen but the humanoid is not a member of the player... Here's the output:
Crimonal has been chosen! 08:49:21.091 - Humanoid is not a valid member of Player 08:49:21.132 - Script 'Workspace.Script', Line 10 08:49:21.133 - Stack End |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2014 07:54 AM |
You defined 'crimonal' as the player Crimonal. The humanoid is in the player's character...
so..
criminol.Character.Humanoid.MaxHealth = 150
--Blablabla |
|
|
| Report Abuse |
|
|