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

Error - "Attempt to connect failed: Passed value is not a function" How can I fix it?

Hello! I made a door breaking by tool script but there is an error "Attempt to connect failed: Passed value is not a function" How can I fix it?

Script: Local Script `local door = game.Workspace.DoorHouse

local function onTouch(door) wait(3) game.Workspace.Door.Anchored = false

end door.Touched:Connect(onTouch())`

2 comments

0

onTouch() runs the code of function onTouch. onTouch is the function. The Connect function takes a function for its argument. Remove the double parenthesis. door.Touched:Connect(onTouch)

0

Beautiful.

1 answer

✓ Accepted answer

just saying what pidgey said, change door.Touched:Connect(onTouch()) to door.Touched:Connect(onTouch)

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