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 !