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: If and then

Previous Thread :: Next Thread 
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
02 Sep 2013 11:48 AM
I want to make a script that when the health is down to 0 then an explosion would come out of the torso...
this is what i did:

if script.Parent.Humanoid.Health = 0 then
local e = Instance.new("Explosion",Guy)
e.Position = workspace.Guy.Torso.Position.Value
end

output says:
Workspace.NakedGuy.Script:1: 'then' expected near '='

what i did after and then it didnt have the red line under it

if script.Parent.Humanoid.Health == 0 then
local e = Instance.new("Explosion",Guy)
e.Position = workspace.Guy.Torso.Position.Value
end

Now output doesnt say anything but it still doesnt give the explosion

Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
02 Sep 2013 11:53 AM
'Guy' Isnt defined
Report Abuse
BlueBlood12 is not online. BlueBlood12
Joined: 07 Jul 2011
Total Posts: 1377
02 Sep 2013 11:55 AM
Your code:
if script.Parent.Humanoid.Health = 0 then
What is should be:
if script.Parent.Humanoid.Health == 0 then
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
02 Sep 2013 11:57 AM
guy = workspace.Guy
if script.Parent.Humanoid.Health == 0 then
local e = Instance.new("Explosion",Guy)
e.Position = Guy:GetModelCFrame().p
end
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
02 Sep 2013 12:07 PM
Oh, i g2g right now so ill check later if they work
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
02 Sep 2013 12:20 PM
The proposed solutions would have one issue, if the humanoid's health wasn't equal to zero at the exact time the script was executed nothing would happen. Look into the 'Died' event.
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
02 Sep 2013 12:39 PM
How would i fix that? Put a while true do?
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
02 Sep 2013 12:44 PM
nvm im dumb that doesnt have to do with anything here
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