Do you know why TextButtons do not work in that case?
They don’t change colors on hover (like this)
They don’t react to scripts.
It is on a SurfaceGui.
Here’s my code:
function onClick()
print("oof")
end
for i, v in pairs(script.Parent:GetChildren()) do -- Loops in the SurfaceGui
if v:IsA("TextButton") then -- Checks if it's a TextButton
v.MouseButton1Click:Connect(onClick) -- Activates
end
end
script.Parent.A.MouseButton1Click:Connect(onClick) -- Attempt to check if it was the for loop above causing the issue, didn't fix it.
function onClick()
print("oof")
end
for i, v in pairs(script.Parent:GetChildren()) do -- Loops in the SurfaceGui
if v:IsA("TextButton") then -- Checks if it's a TextButton
v.MouseButton1Click:Connect(onClick) -- Activates
end
end
script.Parent.A.MouseButton1Click:Connect(onClick) -- Attempt to check if it was the for loop above causing the issue, didn't fix it.
The SurfaceGui has to be a parent (or descendant) of the player’s PlayerGui for it to be functional and react to player inputs. You will have to put the gui in StarterGui and change the gui’s Adornee property for it to be visible on the part