I need help in this easy script

Hey, I am doing map voting rn and I have a weird problem.
Here is the script

local LabButton = script.Parent.LabButton

local LabVote = 0

if LabButton.MouseButton1Click then
	print("labvoted")
end

When I start the game it already prints, but I didn’t even pressed ther button yet.

make it a function not a if statment. like this
LabButton.MouseButton1Click:Connect(function()

end)

is an event.

Your code prints "labvoted" when .MouseButton1Click exists, not everytime it happens. To do that you have to do what watermelon10876 said

1 Like

Yeah I tried that and It worked. Thank you.