Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my 'Touched' function not running?

Asked by
XRed03 17
2 years ago

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?

0
For me, It's working. It may be plugins printing too much once you play a game in Roblox Studio's output PLplayz999 14 — 2y
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 RAFA1608 543 — 2y

1 answer

Log in to vote
0
Answered by
XRed03 17
2 years ago

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

Ad

Answer this question