i want to find the clicker of a gui button and i don’t know if there is a way to do it, so please tell me in the replies if there is one
THIS IS NOT FREE CODE REQUESTS
Well you would do it like this:
local button = --button variable
button.MouseButton1Click:Connect(function(player) -- player is the parameter for the player that clicked the button
print(player.Name) -- Then we printed the name of the Player that clicked it
end)
You can simply access the LocalPlayer within the LocalScript of the GUI, since it would be detecting interactions from each Client/player in the game and not the server:
local Players = game:GetService("Players")
local player = Players.LocalPlayer --[[
This is the reference you could use for the player, no matter if it's
within a function in the LocalScript or not --]]
Here’s its documentation on the Roblox Developer Hub for more information: [ Players | Documentation - Roblox Creator Hub ]