Specific people allowed to click(simple script?)

Hi,

I am creating a script, which allows a specific player to open a button, which would reveal other textbuttons(that other players can’t see). But the script isn’t working.

1 Like

Should be open.MouseButton1Click not open.Activated.

1 Like

but open is the variable for the button, which the player would click.

1 Like

Replace Activated with MouseButton1Click.

1 Like

Isn’t mousebutton1click the same as activated?

1 Like

Once I used Activated as an alternative to MouseButton1Click (for testing purposes), but Activated did not work like MouseButton1Click. Therefore, MouseButton1Click is different from Activated.

local commandbox = script.Parent.TestercommandsBox
local Open = script.Parent.Open
local player = game.Players.LocalPlayer

Open.MouseButton1Click:Connect(function()
if player.Name == "Ghost8058" then
     commandbox.Visible = true
else
     commandbox.Visible = false
end
end)
1 Like

ok, i will try if it works with mousebutton1click, tomorrow. A bit busy right now.

1 Like
local PlayersAllowed = {

-- Player ID's here

}


local function PlayersAllowed(Player)
	for _, userId in ipairs(PlayersAllowed) do
		if Player.UserId == playeridhere then
			return true
		end
	end
	return false
end
-- Continue with your code
2 Likes

I believe Activated is somewhat a new event, or if not, then I must have never heard of it. Normally MouseButton1Click is the action when a player clicks a button, it works on all platforms and I have seen it in other games.
I hope this helps!

1 Like

Activated is an event that triggers whenever LMB is pressed down. Deactivated is an event that triggers whenever someone lets go of LMB. They are both used for Tools only!

1 Like

While that is true, it is also on GuiObjects.

4 Likes

Huh, never heard about that either.

1 Like

Put this “tester commands” in starter GUI.

1 Like

Thanks it worked! But how do i add more than one player to the list? Because right now, only i am able to see the Tester commandbox.

image

1 Like

What does this bit do? I’m interested

1 Like

It’s a for loop that helps find out if the player is allowed to use the gui. Btw i made a mistake, check the code out again, it should work

1 Like

Ok here is where you have it wrong “Activated” is something used for tools when it is clicked on. Change the code to

Open.MouseButton1Click:Connect(function()

1 Like

Here is how you would add more then one player.

if player.Name == “Ghost8058” or “VeinTweek” or “ROBLOX” then

just keep adding an or.

2 Likes

Activated is not only for tools, please refer to my post.

1 Like