manops5
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 49 |
|
|
| 04 Sep 2013 11:54 PM |
| I'm new to scripting, but this should be pretty easy for you guys. I want a script to make a brick hurt/kill you on-touch, but ONLY if the brick is collidable. So if the brick turns uncollidable, it won't hurt you anymore. Help is greatly appreciated! Thank you! |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
| |
|
Maileh
|
  |
| Joined: 14 Jun 2011 |
| Total Posts: 1067 |
|
|
| 05 Sep 2013 12:03 AM |
| http://wiki.roblox.com/index.php/Scripting_Book |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 05 Sep 2013 12:09 AM |
Im experimenting with returns, so this may not work.
Inside a part.
lal = script.Parent
lal.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") and hit.CanCollide == false then return end hit.Parent.Humanoid:TakeDamage(100) end end) |
|
|
| Report Abuse |
|
|
|
| 05 Sep 2013 12:15 AM |
OP asked to not kill the player when the BRICK is not collideable, so yeah it broke. But I dun see wai u has to use return fo dis.
Line4: hit.CanCollide == false change to lal.CanCollide == false then return end
lal = script.Parent
lal.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") and lal.CanCollide == false then return end hit.Parent.Humanoid:TakeDamage(100) end end) |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 05 Sep 2013 12:17 AM |
Facepalm, exactly why theres a return, it does nothing if uncancollide. If its not, it proceeds to the next line. Also error, you were checking if script.Parent was cancollides.
Get on my lvl fro Lal jk |
|
|
| Report Abuse |
|
|
|
| 05 Sep 2013 12:19 AM |
| Meh, screw return, nobody likes it, Roblox, REMOVE IT |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 05 Sep 2013 12:20 AM |
| True, i kind of still dont get it, but looking at it now, its oretty helpful. |
|
|
| Report Abuse |
|
|
|
| 05 Sep 2013 12:20 AM |
Shaddap, STAHP LARNIN RETURN U NAB lel jkbruh cheel
"Meh, dis is my forum signature" |
|
|
| Report Abuse |
|
|
|
| 05 Sep 2013 04:01 AM |
brick = script.Parent touched = false brick.Touched:connect(function(part) if touched then return end touched = true if not brick.CanCollide then touched = false return end local player = game.Players:GetPlayerFromCHaracter(part.Parent) if not player then touched = false return end local char = player.Character it not char then touched = false return end char:BreakJoints() touched = false end) |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
|
| 05 Sep 2013 06:42 AM |
@Above
What are you talking about? I use scripts like that everytime and they always work. |
|
|
| Report Abuse |
|
|