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

how do you make a surface gui text button return the player who clicked?

here's what i have so far it errors saying p is a number value

local textbutton=script.Parent
local allowed={'Player','Player1','Player2'}
textbutton.MouseButton1Down:connect(function(p)
	for i,v in pairs(allowed)do
		if p.Name:lower()==v:lower()  then
			print'allowed'
		else print'not allowed'
		end
	end
end)

1 comment

0

If it's a localscript, just use game.Players.LocalPlayer

1 answer

✓ Accepted answer

http://wiki.roblox.com/index.php?title=API:Class/GuiButton/MouseButton1Down

If you read the page, it shows that your arguments for the MouseButton1Down event are int values which get the position at which the mouse was pressed down.

You can fix this if you're in a local script by just getting the player by using this: p = game.Players.LocalPlayer

3 comments

0

format link

0

Oh, thanks for catching that

0

np

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