.Touched not working?

Hello. I am trying to do something after a player touches the part, but it does not work. Literally just doesn’t work, I’m 99% sure this code should work.

Details:
It’s a script. not a localscript.
The script is under the part in the workspace.
image

Script itself

script.Parent.Touched:Connect(function(otherPart)
	print(otherPart)
end)

Part Properties


image

And yet, nothing happens…
No prints in the client output or server output.

What am I missing?

2 Likes

Is CanTouch checked in the part the script is in.

2 Likes

The code works perfectly fine in my game.

However, you can try this modified script which gives a visual update instead of output.

print("Running")

script.Parent.Touched:Connect(function(otherPart)
	script.Parent.BrickColor = BrickColor.random()
end)

print("Ended")

Let me know what happens!

Yep. Its enabled.

image

There is no reason at all for this to not work…

1 Like

It suddenly works… apparently restarting studio worked for some reason…?

Weird glitch. Anyway, thanks for the help bro!

1 Like

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