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

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

Asked by 4 years ago

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())`

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) pidgey 548 — 4y
0
Beautiful. NIMI5Q -2 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question