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

Why do i keep getting an error with this script?

Asked by
nich17 95
9 years ago

i am trying to run a function that uses a clickdetector to start it but i keep getting the error that it was unable to connect the button and the function so whats wrong with the connect line?

button1e.ClickDetector.MouseClick:connect(buttonPressed(button1e, floor1, 1, floor1Arrived))

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
9 years ago

You problem with the given code is that you have too many parameters on MouseClick. The only parameter of MouseClick is a pointer to the player who clicked. Also, the parameters of the function do not belong in the connection line, but rather in the function line.

local button1e = game.Workspace.Button1e -- location of button1e

function buttonPressed(playerWhoClicked) -- playerWhoClicked is the only possible parameter for the MouseClick function, varaible can be named anything though.
-- code
end

button1e.ClickDetector.MouseClick:connect(buttonPressed)

I'm not sure how your parameters for buttonPressed in your connection line fit into the script, so I can't really help you there unless you post more of your script.

0
thank you for the help i did not know that was the only parameter mouseclick could have nich17 95 — 9y
Ad

Answer this question