I put a textbutton inside a surface gui which is in a part. I put a localscript and a simple code:
local Gui = script.Parent.Parent
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
print(1)
end)
it doesn't print anything, or any error til I change a localscript into a script with the same code. This time, it prints 1 and I started to feel something's wrong.
Moreover, I want to get the Local player, who click the button, can anyone help me? Thanks a lot!

1 comment
This will not work as player is not connected correctly. He also didnt ask for player to be connected.