|
| 13 Sep 2011 05:12 PM |
I'm looking to make a script that damages the player slightly every second, but if the player steps off of it, it stops damaging him. Here is my kill script, it just needs some editing:
dmg = 1000 script.Parent.Touched:connect(function(hit) if hit.Parent.Humanoid then do hit.Parent.Humanoid:TakeDamage(dmg) end end end) |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:13 PM |
You know it wont slightly take their health, it will kill the Player.
|
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:14 PM |
'it just needs some editing'
Learn to read. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:20 PM |
| Dios mío! Can no one answer this? |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:28 PM |
dmg = 1000 script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid:TakeDamage(dmg) end end end)
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:31 PM |
Why did you just copy my script?
Plus that wouldn't even work.
Can you FREAKING learn to READ? READ. THE. ENTIRE. THREAD. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:32 PM |
Script, YOU learn to read. Your's wouldn't work for two reasons:
1. if statements do _NOT_ use a 'do' 2. If hit's parent didn't have a Humanoid, it would error.
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
Dyvoliox
|
  |
| Joined: 08 Sep 2011 |
| Total Posts: 28 |
|
|
| 13 Sep 2011 05:33 PM |
@ScriptDrone
I read the entire thread :D
I would use the .StoppedTouching event, but, of course, it's locked, so you should either use a while loop with magnitude or a while loop with Region3. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:33 PM |
I COULD CARE LESS! YOU'RE NOT HELPING ME! I'M TRYING TO MAKE IT SO IT SLOWLY DAMAGES YOU, BUT IF YOU STEP OFF OF IT, IT STOPS! |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:34 PM |
@Dy
I'm not really sure how to do that, though D: |
|
|
| Report Abuse |
|
|
WishNite
|
  |
| Joined: 11 Feb 2009 |
| Total Posts: 15828 |
|
|
| 13 Sep 2011 05:35 PM |
| Or you can use magnitude... |
|
|
| Report Abuse |
|
|
Dyvoliox
|
  |
| Joined: 08 Sep 2011 |
| Total Posts: 28 |
|
|
| 13 Sep 2011 05:38 PM |
Hmm. I don't really know magnitude or Region3, I just know it's something like this:
--Put this in the brick while true do local chil = game.Workspace:getChildren() for i, v in pairs(chil) do if v:findFirstChild("Humanoid") then if v:findFirstChild("Torso") then if v.Torso.Position - script.Parent.Position.magnitude >= 1 then local s = script.Parent.damagingScript:Clone() --[[Make sure the damaging script is in the brick]] s.Parent = v wait() else print("Not close enough. Do nothing.") end end end end end
|
|
|
| Report Abuse |
|
|
Dyvoliox
|
  |
| Joined: 08 Sep 2011 |
| Total Posts: 28 |
|
|
| 13 Sep 2011 05:39 PM |
| If my script doesn't work (chances are it will, I just guessed at the magnitude part), give it to ElectricBlaze and he might fix it. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:40 PM |
Yes, that wouldn't work. But I'm not sure if I want to fix it, now.
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:42 PM |
Okay, fine, whatever. But ScriptDrone, try not to yell at us when we're only teying to help. Thanks. xP
Try this:
while true do local chil = game.Workspace:GetChildren() for i, v in pairs(chil) do if v:findFirstChild("Humanoid") then if v:findFirstChild("Torso") then if (v.Torso.Position - script.Parent.Position).magnitude >= 1 then local s = script.Parent.damagingScript:Clone() --Make sure the damaging script is in the brick s.Parent = v wait() else print("Not close enough. Do nothing.") end end end end end
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
Dyvoliox
|
  |
| Joined: 08 Sep 2011 |
| Total Posts: 28 |
|
|
| 13 Sep 2011 05:43 PM |
@ElectricBlaze
So all I did was forget parenthesis? D:
i no be happy |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 05:44 PM |
lololol
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
Dyvoliox
|
  |
| Joined: 08 Sep 2011 |
| Total Posts: 28 |
|
|
| 13 Sep 2011 05:48 PM |
@ElectricBlaze
dood whai u laugh bro not cul |
|
|
| Report Abuse |
|
|