Howdy. I have a part (call it part A) that is inside a doorway of sorts. Another script teleports a new part (call it part B) inside of part A.
Part A has the following script:
function onTouch(part) wait() print("Touched") if part.Parent.Name == "Room" then print("Room") script.Parent.Parent.OpenEnds.Value = script.Parent.Parent.OpenEnds.Value - 1 script.Parent:Destroy() end end script.Parent.Touched:connect(onTouch)
The code that teleports part B into part A:
roomModel.Parent = game.Workspace --roomModel:MoveTo(position) roomModel:SetPrimaryPartCFrame(CFrame.new(position)) if roomModel.PrimaryPart.Position.Y > script.Parent.Position.Y then roomModel:Destroy() end
The way part B is teleported is in a SetPrimaryPartCFrame. As a result, part B teleports inside part A. The problem I am having is that it seems that the onTouch function is not firing, as neither "Touched" nor "Room" print. Even though part B is CFramed into part A, part A's script does not register them as touching. Thanks in advance.
I believe Touched doesn't run if it's directly tp'ed in the part , try using magnitude?