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

How can I check if a player has already clicked a button before?

Is it possible to check if a player has already clicked a button? Like if a player has already went through the Surface GUI and got something and then when they click it again they wouldn't be able to.

1 comment

0

On a Surface GUI you carnt find the player, there are a lot of question on this forum relating to this. You might be able to do somthing localy with FE enabled http://wiki.roblox.com/index.php?title=Local_parts

2 answers

The best way to do this would be to place the surfacegui into StarterGui. That way, you can track which player clicked it. An example:

LocalScript inside surfacegui:

script.Parent.Adornee = workspace.GuiPartExample

Then, to check if the player has already clicked it, you can insert a value into the player! Example inside a localscript:

local plr = game.Players.LocalPlayer
script.Parent.Button.MouseButton1Down:connect(function()
	if not plr:FindFirstChild('ClickedButton') then
-- do stuff
local value = Instance.new('BoolValue',plr)
value.Name = 'ClickedButton'
end)

2 comments

0

The LocalScript doesn't make anything visible that's the problem.

0

If you want, I could create an example place?

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