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: I need a water script

Previous Thread :: Next Thread 
DarkDemon01 is not online. DarkDemon01
Joined: 20 Sep 2008
Total Posts: 9277
24 Aug 2013 02:57 PM
Something that will drain your health if it touches your head as you continue to touch it
Report Abuse
Digitalizing is not online. Digitalizing
Joined: 13 Aug 2013
Total Posts: 1057
24 Aug 2013 03:02 PM
local water = script.Parent

function onTouch(part)
local hum = part.Parent:findFirstChild("Humanoid")
if (hum~=nil) then
touched = true
local char = hum.Parent
if part = char.Head then
while true do
if touched = true then
hum.Health = hum.Health - 1
end
end
end
end
end

water.Touched:connect(onTouch)
water.TouchEnded:connect(function(otherPart)
touched = false
end)
Report Abuse
DarkDemon01 is not online. DarkDemon01
Joined: 20 Sep 2008
Total Posts: 9277
24 Aug 2013 03:07 PM
^doesn't work, too many unspecified values

what's water?
whats otherPart?
Report Abuse
Digitalizing is not online. Digitalizing
Joined: 13 Aug 2013
Total Posts: 1057
24 Aug 2013 03:09 PM
>local water = script.Parent

put the script inside the water
Report Abuse
Geomaster is not online. Geomaster
Joined: 05 Jul 2008
Total Posts: 1480
24 Aug 2013 03:09 PM
Lol, otherPart's the name of a one-line function that he created in the same line as the connection to it

'water' is the water part in question, he's just tagging it as that assuming the script is inside the water brick
Report Abuse
DarkDemon01 is not online. DarkDemon01
Joined: 20 Sep 2008
Total Posts: 9277
24 Aug 2013 03:19 PM
Once I leave the water, my client crashes....
I had the same time with touching it, but I solved it by adding a wait...
Report Abuse
Digitalizing is not online. Digitalizing
Joined: 13 Aug 2013
Total Posts: 1057
24 Aug 2013 03:51 PM
try adding a debounce.
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
24 Aug 2013 03:53 PM
water = script.Parent
db = false

water.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") and not db then
db = true
repeat
wait(.5)
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -1
until
hit.Parent.Humanoid.Health <= 0
db = false
end
end)


--This might not work

Report Abuse
DarkDemon01 is not online. DarkDemon01
Joined: 20 Sep 2008
Total Posts: 9277
24 Aug 2013 03:54 PM
@digit
I fail
how?
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