For example, a button, is it possible to activate the click detector on a button without actually clicking it in lua ?
COMMUNITY QUESTION
Is it possible to activate a click detector without actually clicking it ?
1 answer
Yes you can. Here is an example that may help.
function OnClick() --The function for what the button does.
print("BoxedHouses Rules!") --You dont have to keep this, it's an example.
--What you want the button to do here.
end
game.Workspace.button.ClickDetector.MouseClick:connect(OnClick()) --Calls the function when the button is pressed.
--Here is your code.
game.Workspace.car.BrickColor = BrickColor.new("Really red")--You dont have to keep this, it's an example.
OnClick()--Calls the function without needing to press the button.
If it helps, please accept the answer, and if it doesn't, tell me any errors.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Why would you?
@hiimgoodpack Possibly a gamepass where you don't have to keep clicking