Hello, I am here just to take out an dobut that seriously intrigates me.
It's about with pure CFrame. While I was adusting an ascensor, I noticed that the Module could not detect touches with GhostPlates, then it could not update the stage where it was, so it does not know where it should stop (result, it is going up and up and up until the space.)
But we are going to go back to the example.
Let's imagine a simple example. I have two parts, one called Part1
and another called Part2
:
http://i1241.photobucket.com/albums/gg505/dav1000999/RobloxScreenShot10172015_214725602.png
The Part1
is CanCollide
and Part2
not. (Part1
is the ascensor floor and the Part2
is the GhostPlate I refered above.)
Part1
is going to move around (up and down) Part2
so it touches it multiple times. Both are Anchored
.
To move the Part1
, I have something like that:
while true do for i = 9.5, 3.5, -2/30 do script.Parent.CFrame = CFrame.new(script.Parent.Position.X, i, script.Parent.Position.Z) wait() end for i = 3.5, 9.5, 2/30 do script.Parent.CFrame = CFrame.new(script.Parent.Position.X, i, script.Parent.Position.Z) wait() end end
Simple, right? It will move the part smoothly, so it will absolutely touch the Part2
Now ill script it in order to say something onTouch.
script.Parent.Touched:connect(function(h) -- when part is touched if h.Name == "Part2" then -- if the part is the Part2 print("Touch. Touch. Touch.") -- then say this message. end end) coroutine.resume(coroutine.create(function() -- create a coroutine in order to keep the event and the loop running at the same time. while true do -- CFraming script. for i = 9.5, 3.5, -2/30 do script.Parent.CFrame = CFrame.new(script.Parent.Position.X, i, script.Parent.Position.Z) wait() end for i = 3.5, 9.5, 2/30 do script.Parent.CFrame = CFrame.new(script.Parent.Position.X, i, script.Parent.Position.Z) wait() end end end))
Nothing in the output.
Does someone understand why?
CFraming has objects go through others therefore not allowing the onTouched event, you could have it instead, stop when the Y Coordinates are the same on both parts.