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 » Scripters
Home Search
 

why dont this work

Previous Thread :: Next Thread 
RepuIsed is not online. RepuIsed
Joined: 19 Sep 2016
Total Posts: 47
20 May 2017 05:39 PM
local h = game.Players.LocalPlayer.Character:findFirstChild("Humanoid")

if h.MaxHealth == 0 then
h.Health = 0
Report Abuse
LinkMe is not online. LinkMe
Joined: 30 Apr 2009
Total Posts: 512
20 May 2017 05:42 PM
You're missing an 'end' to close the if statement.
Report Abuse
RepuIsed is not online. RepuIsed
Joined: 19 Sep 2016
Total Posts: 47
20 May 2017 05:42 PM
already had that but it still doesn't work
Report Abuse
Cyrakohl is not online. Cyrakohl
Joined: 09 Nov 2014
Total Posts: 3197
20 May 2017 05:46 PM
Is this a local script? also it's "FindFirstChild" not findFirstChild


Report Abuse
RogueMage is not online. RogueMage
Joined: 28 Jan 2012
Total Posts: 1235
20 May 2017 05:48 PM
:findFirstChild works



My guess is that Character is nil

write the whole code like this


local player = game.Players.LocalPlayer

player.CharacterAdded:wait()


And then do all the same things

Report Abuse
ForceCyber is not online. ForceCyber
Joined: 06 May 2015
Total Posts: 1086
20 May 2017 07:00 PM
local h = game.Players.LocalPlayer.Character:findFirstChild("Humanoid")

if h then -- define the humanoid.

if h.MaxHealth == 0 then
h.Health = 0

--This works.^



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