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: dead car

Previous Thread :: Next Thread 
PRESTIGIOUSaLEGEND is not online. PRESTIGIOUSaLEGEND
Joined: 16 Apr 2011
Total Posts: 1765
19 Jan 2013 09:51 AM
i need help on a script that when a car has 0 health it doesnt move anymore it just stays still as if it is anchored or if this script is changable for remove the car but still alow its regenability that would be good also


h = script.Parent.Humanoid

while true do
if h.Health > 0 then
h.Health = h.Health
elseif h.Health < 1 then
script.Parent.VehicleSeat.Disabled = true
end
end


-------------------------OR-------------------------

h = script.Parent.Humanoid
s = script.Parent.Head

while true do
if h.Health > 0 then
h.Health = h.Health
elseif h.Health <1 then
s.Anchored = true
end
end

-----------------------OR----------------------------

h = script.Parent.Humanoid

while true do
if h.Health > 0 then
h.Health = h.Health
elseif h.Health <1 then
script.Parent:remove()
end
end
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
19 Jan 2013 09:54 AM
I'd use a .Changed, so you're not causing lag.

local life = script.Parent.Humanoid
life.Changed:connect(function()
if life.Health > 0 then return end
if life.Health <= 0 then
script.Parent:Destroy() --or w/e you want to use here.
end
end
end)
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
19 Jan 2013 09:55 AM
--edit

local life = script.Parent.Humanoid
life.Changed:connect(function()
if life.Health > 0 then return end
if life.Health <= 0 then
script.Parent:Destroy() --or w/e you want to use here.
end
end)
Report Abuse
PRESTIGIOUSaLEGEND is not online. PRESTIGIOUSaLEGEND
Joined: 16 Apr 2011
Total Posts: 1765
19 Jan 2013 10:04 AM
unfortunately didnt work

output said need ")" to close "(" on line 2 ? but it looks like it is closed so the car didnt destroy it just acted as it normally does
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
19 Jan 2013 10:07 AM
Use the one that says "--edit".
Report Abuse
8SunTzu8 is not online. 8SunTzu8
Joined: 30 Sep 2011
Total Posts: 8199
19 Jan 2013 10:08 AM
lol, extra end

His script should work.

"If you want to become a Developer or Innovator for CSA, contact me."
Report Abuse
PRESTIGIOUSaLEGEND is not online. PRESTIGIOUSaLEGEND
Joined: 16 Apr 2011
Total Posts: 1765
19 Jan 2013 10:10 AM
ty it worked :)
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