I’m working on a timer and i was preparing the model for it, but for some reason the button never worked. So I tried to make another button just to make sure im not making a mistake, and the button doesnt work. Heres the code:
local button = script.Parent.SurfaceGui.TextButton
print("works")
button.Activated:Connect(function()
print("works")
end)
a fairly reminder that surface gui in parts do NOT connect events that are made for client, you will have to put it in StarterGui and set the adornee to the part desired.
Please use the following script. Note that this should be a LocalScript instead of a ServerScript. Additionally, remember that SurfaceGuis are not the same as ScreenGuis; SurfaceGuis are meant for parts, while ScreenGuis are for the player’s screen.
Here is the fixed script you should use:
local button = script.Parent.SurfaceGui.TextButton
print("works")
button.MouseButton1Click:Connect(function()
print("works")
end)