Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How could you reach a player who clicked a gui?

I need to find a way to reach a player who clicks on a textbutton without using a localscript, could any of you guys help?

2 comments

0

You would be better off using a LocalScript. It's actually recommended you use a LocalScript for Gui objects. Otherwise you would have to go script.Parent.Parent.Parent or however many parents it may take to get to the player.

0

The script that I have originally uses a localscript, but for some reason it messes everything up, which is why i'm trying to switch over to a serverside one.

1 answer

script.Parent.MouseButton1Click:connect(function(plr)
local player = game.Players:FindFirstChild(plr.Name)
end)

5 comments

0

excuse me if im wornf

0

Thank you for the help.

0

no problem

0

That doesn't work. MouseButton1Click does not return the player, it never did return the player. It will only return a number value being where on the button the player clicked.

0

How could I get it to return the player?

This discussion is preserved as it was. New answers, comments, and votes are closed.