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: Hmmm, While touched?

Previous Thread :: Next Thread 
ozza is not online. ozza
Joined: 11 Oct 2007
Total Posts: 726
04 May 2012 09:37 PM
So, I was wondering how to stop doing damage after they aren't touching the lava.


hit = false
db = false

script.Parent.Touched:connect(function(hit)
g = hit.Parent:findFirstChild("Humanoid")
if db == false and g then
hit = true
for i = 1,10 do
g:TakeDamage(1)
wait()
end
end
end)
Report Abuse
mage11561 is not online. mage11561
Joined: 03 Sep 2008
Total Posts: 13217
04 May 2012 09:41 PM
You could check the magnitude, and if it exceeds a certain parameter, it'll assume you're not touching anymore.
Report Abuse
DXPower is not online. DXPower
Joined: 21 Oct 2008
Total Posts: 2866
04 May 2012 09:52 PM
Or use the .TouchEnded event...

With a Five-Guys burger in my hands, I am now invincible!
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
04 May 2012 09:53 PM
Idk, I guess this will work:



local t = false

script.Parent.Touched:connect(function(item)
if (t) then return end
local player = game.Players:GetPlayerFromCharacter(item.Parent)
if (not player) then return end
t = true
while (t) do
wait(0.1)
player.Character.Humanoid:TakeDamage(2)
end
end)

script.Parent.TouchEnded:connect(function()
t = false
end)
Report Abuse
mage11561 is not online. mage11561
Joined: 03 Sep 2008
Total Posts: 13217
04 May 2012 09:53 PM
They added TouchEnded?


AWESOME
Report Abuse
ozza is not online. ozza
Joined: 11 Oct 2007
Total Posts: 726
04 May 2012 10:36 PM
Thanks @ crazy. c:
Report Abuse
michaelaqz4 is not online. michaelaqz4
Joined: 23 Sep 2009
Total Posts: 1940
04 May 2012 10:48 PM
Im pretty sure CrazyMan (Some numbers) made one
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