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
 

[ Content Deleted ]

Previous Thread :: Next Thread 
juanse71 is not online. juanse71
Joined: 12 Jan 2009
Total Posts: 6784
21 Sep 2012 08:41 PM
[ Content Deleted ]
Report Abuse
juanse71 is not online. juanse71
Joined: 12 Jan 2009
Total Posts: 6784
21 Sep 2012 08:42 PM
[ Content Deleted ]
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 08:48 PM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
while true do
for i = 100,0,-20 do
h.Health = i
wait(1)
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
21 Sep 2012 08:51 PM
^

That would error at some point
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 08:52 PM
This one is better.


function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
while true do
for i = 100,0,-1 do
h.Health = i
wait(0.05)
end
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 08:53 PM
Miz, it didn't error for me..
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 08:55 PM
Oh, I need debounce.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
21 Sep 2012 08:57 PM
"while true do
for i = 100,0,-1 do
h.Health = i
wait(0.05)
end
"

This would loop over and over and over. So it could error if one I leave so there is no humanoid or too I already died when the loop is starting. It would of been better to say

while h.Health > 0 do
--code
end

Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 08:58 PM
oh

ok
Report Abuse
juanse71 is not online. juanse71
Joined: 12 Jan 2009
Total Posts: 6784
21 Sep 2012 09:02 PM
[ Content Deleted ]
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
21 Sep 2012 09:03 PM
@miz

*second
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 09:06 PM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
while h.Health > 0 do
h.Health = h.Health - 1
wait(0.05)
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
21 Sep 2012 09:08 PM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
while h.Health > 0 do
h.Health = h.Health -1 --do spaces count?
wait(0.05)
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 09:09 PM
@X

No, it is just easier to read with spaces.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
21 Sep 2012 09:10 PM
oh.
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