Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my 'Touched' function not running?

I am trying to have a local script so that when the player touches a union, it will print the word "awesome" into the output, but whenever I touch the union, it does not print "awesome". Here is my code:

local part = script.Parent

local function objectTouched(touch)
	if touch.Parent:FindFirstChild("Humanoid") then
		print("awesome")
	end

end

part.Touched:Connect(objectTouched)

Are there any errors in this code that would prevent it from running?

2 comments

0

For me, It's working. It may be plugins printing too much once you play a game in Roblox Studio's output

0

I've seen something about uncancollide parts ignoring touched events for some reason, but I have uncancollide triggers in my game and they work fine

1 answer

Found out why. I was using a localscript, not a regular script.

This discussion is preserved as it was. New answers, comments, and votes are closed.