|
| 25 Mar 2015 09:51 PM |
Hello-
So I have two parts that are gradually getting closer and closer to each other. When the two parts touch, I want something to happen. I scripted something like this in an attempt to get something to happen but alas, nothing appears, or disappears.
local Bot = script.Parent
function OnTouched() print("Bye bye") Bot:Destroy() end
Bot.Touched:connect(OnTouched)
Any help is appreciated. Thanks! |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 25 Mar 2015 09:52 PM |
| Touched isn't triggered if your parts are being CFramed. |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2015 09:55 PM |
| Ah that's what I thought. My second question would then be if there's any alternate way to test a collision? |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 25 Mar 2015 09:57 PM |
Yup, multiple ways. However I would recommend just not trying any of those ways. Instead it would be better to either move the parts some other way, such as BodyPosition.
If you move them with BodyPosition, it can be a slow sliding effect like you want, and it will not interfere with the Touched Event. |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2015 10:36 PM |
Ok I figured out what exactly you meant but now I want to make that bricks position always equal to a Moving humanoid I have programmed to Walk to certain spots. I tries using this but nothing happened: while true do wait(1) game.Workspace.Part.BodyPosition.position = Vector3.new(game.Workspace.Bot1.Head.Position) end |
|
|
| Report Abuse |
|
|