Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How could you reach a player who clicked a gui?

Asked by 8 years ago

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?

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. M39a9am3R 3210 — 8y
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. hulabee 7 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
script.Parent.MouseButton1Click:connect(function(plr)
local player = game.Players:FindFirstChild(plr.Name)
end)
0
excuse me if im wornf sentry3 6 — 8y
0
Thank you for the help. hulabee 7 — 8y
0
no problem sentry3 6 — 8y
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. M39a9am3R 3210 — 8y
0
How could I get it to return the player? hulabee 7 — 8y
Ad

Answer this question