|
| 17 Aug 2011 09:47 PM |
function onTouched(hit) game.Workspace.Player.Head:Remove() end script.Parent.Touched:connect(onTouched)
--My suspicion is if the Torso Touches it then it breaks. If that were the case how could you prevent it? |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 09:49 PM |
function onTouched(hit) if game.Workspace:findFirstChild("Player") then game.Workspace.Player:BreakJoints() end end script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 09:49 PM |
| I dont want the script i want to know why mine didnt work |
|
|
| Report Abuse |
|
|
MXrcr20
|
  |
| Joined: 01 Oct 2008 |
| Total Posts: 2644 |
|
|
| 17 Aug 2011 09:49 PM |
function onTouched(hit) h=hit.Parent:findFirstChild("Head") if h then h:Remove() end end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 09:53 PM |
I fixed it all by simply saying function onTouched(hit) game.Workspace.Player.Humanoid.Health = 0 end script.Parent.Touched:connect()
the fact that I have to do this is stupid it should work both ways |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 09:55 PM |
No, it's not. It's because you didn't have debounce in your first script, and that script will STILL error.
When you touch a brick, it runs 2ce because both legs hit it. Because it runs 2ce, the first time it will remove 'Player's' Head. The 2nd time, the output sohuld say 'Head' is a nil value, because it already had been removed. |
|
|
| Report Abuse |
|
|
MXrcr20
|
  |
| Joined: 01 Oct 2008 |
| Total Posts: 2644 |
|
|
| 17 Aug 2011 09:56 PM |
| .Touched scripts with no debounce will run more than twice when you touch them... |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 09:58 PM |
| Well, usually it runs 2ce because 2 legs touch them, but yes as you're moving off the brick you'll touch them again. |
|
|
| Report Abuse |
|
|
bloob827
|
  |
| Joined: 01 Aug 2010 |
| Total Posts: 6867 |
|
|
| 17 Aug 2011 09:59 PM |
script.Parent.Touched:connect(pcall(function(l) game.Players:getPlayerFromCharacter(l).Torso:remove() end)end) |
|
|
| Report Abuse |
|
|
MXrcr20
|
  |
| Joined: 01 Oct 2008 |
| Total Posts: 2644 |
|
|
| 17 Aug 2011 09:59 PM |
| In my output, it runs a script like 15 times with no debounce. |
|
|
| Report Abuse |
|
|