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

Print wont work when i press my textbutton help?

Asked by
mikwbm 9
3 years ago
local Button = game.StarterGui.ScreenGui.Frame.TextButton

Button.mouseclick1:Connect(function()
    print "hello im working)
end)

1 answer

Log in to vote
1
Answered by 3 years ago

Don't reference the button in StarterGui. Reference it in PlayerGui as that is the GUI that the player is currently interacting with. Children of StarterGui are replicated to the player in PlayerGui. There's also no event called mouseclick1. You probably meant MouseButton1Click. Your last error is your print function. Make sure to add your beginning bracket and closing quotation.

local Button = game.Players.LocalPlayer.ScreenGui.Frame.TextButton

Button.MouseButton1Click:Connect(function()
    print("hello I'm working")
end)
Ad

Answer this question