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
 

Re: Touch kill?

Previous Thread :: Next Thread 
TomsTown is not online. TomsTown
Joined: 27 Dec 2010
Total Posts: 452
06 Jul 2015 02:42 PM
Heyy, im trying to make a block that damages the health of my car touches it

I have a variable in the car that is called hp and when this reaches 0 it will explode the car

However how can I link the block and the damage to the car together?

like ontouch, if car then hp.value == -5??

Please can anyone help
Thankyou
TomsTown
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
06 Jul 2015 02:51 PM
script.Parent.Touched(function(crash)
crash.Parent.HP.Value = crash.Parent.HP.Value -5
end)

I assume your car parts are in a model and not anywhere deeper in model (model that is in a model).

~davisky~
Report Abuse
VuItured is not online. VuItured
Joined: 28 Jun 2015
Total Posts: 52
06 Jul 2015 02:54 PM
idk if this works im on my ipad so idk

debounce = false
function onTouch(part)
if debounce == false then
local humanoid = part.Parent:FindFirstChild("Health")
if (humanoid ~= nil) then
debounce = true
humanoid.Value = humanoid.Value - 50
wait(2)
debounce = false
end
end
end

script.Parent.Touched:connect(onTouch)

remember idk if it works


where my cookie
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
06 Jul 2015 02:55 PM
Oh right, forgot to add debounce.


~davisky~
Report Abuse
TheSubatomicalWorld is not online. TheSubatomicalWorld
Joined: 16 Jun 2013
Total Posts: 1193
06 Jul 2015 03:20 PM
script.Parent.Touched:connect(function(plr)
if plr.Parent:findFirstChild("humanoid") then
plr.Parent.humanoid.Health = 0
end
end)



-TheSubatomicalWorld
Report Abuse
VuItured is not online. VuItured
Joined: 28 Jun 2015
Total Posts: 52
06 Jul 2015 09:16 PM
Did mine work for you?



where my cookie
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