How do I return the character who clicks a TextButton?

(insert title here idk)

thanks

textbuttons can only be clicked on the client. Therefor, only the localplayer can click it.

ClickDetectors however, you can detect when those are clicked on the server and get the player who clicked it.

im aware, but is there anyway i can retrieve the character who clicks a textbutton?

If a textbutton can only be clicked on the client, only the client’s user could click it, game.Players.LocalPlayer.Character

I assume the script is inside the textbutton so I’ll do this

script.Parent.MouseButton1Up:Connect(function()

end)

that will play when it is pressed, and the player will be game:GetService(“Players”).LocalPlayer

yes, but that function doesnt store any of the player’s data, right? the only way i can think of retrieving the character of the player is by adding a parameter to the function you listed, but even then it only retrieves the player’s input, not anything related to the character.

game:GetService(“Players”).LocalPlayer.Character

1 Like

On the client you can ALWAYS refer to the player via game.Players.LocalPlayer and from there please refer to the (Dev Hub) player class/(New Documentation) Player | Roblox Creator Documentation

I somehow didn’t get your point the first time, thank you.