Does Ontouched detect a tweening part? Help please

Hello,

Does Ontouched not detect a part that is being tweened?

This seems as simple as it gets. but, I have a script that is tweening the blue part back and forth.

The grey part has ontouched code to detect part, with a print debug statement to let me know it detects any part.

The grey part is not detecting the tweening blue part at all as it moves back and forth…

In test mode, Server, if I unanchor the green part, the grey part script detects the green part

script for the ontouched =


--script when a part called DETECTION is touched by a part called OPEN, print the text 'OPEN the door'



local detectionPart = script.Parent  -- Reference to the DETECTION part

-- Function to handle the touch event
local function onTouch(otherPart)
	-- Check if the part touching is named "OPEN"
	
	print("the part that touched is called: " .. otherPart.Name)
	
    if otherPart.Name == "OPEN" then
        print("OPEN the door")  -- Print the message
    end
end

-- Connect the onTouch function to the Touched event of the detectionPart
detectionPart.Touched:Connect(onTouch)

tween script


--script when a part called DETECTION is touched by a part called OPEN, print the text 'OPEN the door'



local detectionPart = script.Parent  -- Reference to the DETECTION part

-- Function to handle the touch event
local function onTouch(otherPart)
	-- Check if the part touching is named "OPEN"
	
	print("the part that touched is called: " .. otherPart.Name)
	
    if otherPart.Name == "OPEN" then
        print("OPEN the door")  -- Print the message
    end
end

-- Connect the onTouch function to the Touched event of the detectionPart
detectionPart.Touched:Connect(onTouch)
[ontouch with tween.rbxl|attachment](upload://dOsv1jw2iaaTmLG77CbePc2BleG.rbxl) (54.6 KB)

rbxl file

Thanks !

From another thread:

It’s because the parts actually won’t detect other parts unless it’s affected by physics, which won’t happen when both of them are anchored and you’re also tweening them. You can use LinearVelocity on both parts to fix this.

hmm, what it like the I had the grey part unachored on a short rope?.. I will try that

mm, yep if it is on a rope, it will detect the part… thanks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.