charezard
|
  |
| Joined: 29 Nov 2009 |
| Total Posts: 990 |
|
|
| 07 Aug 2011 11:04 PM |
| I used a lava model but I wanted to know how I can make my own lava. But I kinda have a problem... How am I supposed to make it kill?! I hope it doesn't include scripts. >_< |
|
|
| Report Abuse |
|
|
tummey2
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 1802 |
|
|
| 07 Aug 2011 11:15 PM |
It does, but it's simple
function Touch(hit) -- The function if hit.Parent:findFirstChild("Humanoid") then--Checking if hit has a Humanoid hit.Parent:BreakJoints()-- object/model passed test, break joints end end -- endings... script.Parent.Touched:connect(Touch) -- telling the script to connect when --touched with the brick |
|
|
| Report Abuse |
|
|
charezard
|
  |
| Joined: 29 Nov 2009 |
| Total Posts: 990 |
|
|
| 07 Aug 2011 11:25 PM |
So what this script does is tell the function that when someone were to hit this, the Parent would find the Humanoid and break the joints to kill the player?
Also, how do I add this script to the brick? Do I select the brick then Insert > Object... > Script and then paste that into the script? Sorry but I've never done anything that needed scripts. @_@ And when I did that and touched the brick, nothing happened. D: |
|
|
| Report Abuse |
|
|
tummey2
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 1802 |
|
|
| 07 Aug 2011 11:41 PM |
function Touch(hit) if hit.Parent:findFirstChild("Humanoid") then hit.Parent:BreakJoints() end end script.Parent.Touched:connect(Touch)
A function is a quick way of saying alot of code. (This isn't alot but functions are important when using a connect method)
Inside the function i wrote if hit.Parent:findFirstChild("Humanoid") then if means, if an even ocurs. Then just means what happens if that even occurs e.g. if cows fall from the sky then i'll give you a dollar hit.Parent.findFirstChild("Humanoid") is simply saying the thing touching the brick has a Humanoid in it. So if thing touching brick has a Humanoid thing in it then...
hit.Parent:BreakJoint() is simply saying break the joints
So in english we coluld translate this to
if thing touching brick has a Humanoid thing in it then break that things joints
Then we tell the script to use that function when the brick it is inside of is touched. e.g. script.Parent.Touched:connect(Touch)
Regardless, Insert> Object> Script. Paste script above into script. Place script in the killing brick or bricks |
|
|
| Report Abuse |
|
|
tummey2
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 1802 |
|
|
| 07 Aug 2011 11:42 PM |
| Btw make sure when you add your script the game is paused. Then click play to test it. |
|
|
| Report Abuse |
|
|