|
| 14 Jan 2015 09:53 PM |
local Player = game.Players.LocalPlayer local Character = Player.Character if not Character or Character.Parent == nil then Character = Player.CharacterAdded:wait() end local Humanoid = Character.Humanoid
first 5 lines from wiki
line 6 only works in studio test mode, not online; says humanoid is not a valid member. is it something to do with the humanoid not being loaded into the character before the line is run? |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 09:54 PM |
local player = game.Players.LocalPlayer local character = player.Character or player:WaitForChild("Character") local humanoid = character.Humanoid |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Jan 2015 10:03 PM |
| pretty sure it's stuck on second line |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:04 PM |
is it in a localscript?
is it in the startergui?
if you answered yes, then yes it does work |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:04 PM |
| :waitforchild on the humanoid then |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:04 PM |
fixed it, just changed my original line 6 to:
local Humanoid = Character:WaitForChild("Humanoid") |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:05 PM |
| and yes it was in starter gui in a local script |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:05 PM |
if your script doesn't work, it is because the rest of your script is whack.
here's a simple test code to put in a localscript, in the startergui
local player = game.Players.LocalPlayer local character = player.Character or player:WaitForChild("Character") local humanoid = character.Humanoid print(tostring(humanoid.Health))
--it will print 100 because it gets your player, then your character, then your humanoid, and then prints your health |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:07 PM |
| the rest of my script was print("test"), and didn't see "test" in output |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:08 PM |
| btw not testing in studio mode, testing online |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:09 PM |
local player = game.Players.LocalPlayer local character = player.Character or player:WaitForChild("Character") local humanoid = character.Humanoid
if this is your script^^^^^^^^
and then you just say
print("test")
it will work |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2015 10:10 PM |
| yes, it works in studio test mode, but to clarify again, i am testing on a server |
|
|
| Report Abuse |
|
|