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

MouseButton1Click is not a valid member of Button?

Asked by 2 years ago

I'm just trying to make a button that does something when you click it. the problem is it keeps displaying a error saying "MouseButton1Click is not a valid member of Button" All of this code is inside of a local script which is located in the button.

local Player = game.Players.LocalPlayer local Button = script.Parent

Button.MouseButton1Click:Connect(function() print("works") end)

0
are you sure its an ImageButton and not an ImageLabel? potatomay 20 — 2y
0
check if ur have typo or not daokhiethy 25 — 2y
0
Its a Text Button General_ChaosTv 2 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

uuh, don't make button a variable, do that

script.Parent.MouseButton1Click:Connect(function()
    print("this button works!")
end)

this script should be work

0
if you need other thing tell me G4M3RZ1NH00 17 — 2y
0
still doesnt work and displays an error saying "MouseButton1Click is not a valid member of TextBox "Players.General_ChaosTv.PlayerGui.MainGui.SettingsMenu.MusicButton General_ChaosTv 2 — 2y
0
TextBox? Did you use a TextBox instead of a TextButton? lunatic5 409 — 2y
0
Also, use Activated instead of MouseButton1Click if you want your script to work on all platforms. lunatic5 409 — 2y
0
Yep your right it is a textbox. Sry if I waited your time because I'm new at scripting. General_ChaosTv 2 — 2y
Ad

Answer this question