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

Key-press GUI for Certain People, How do I do it?

So, I've made a GUI for Mods/Admins of my game to open for bans and kicking people (simular to arsenal's)

I just need to know.. How do I make it so it Opens/Closes on a key-press and only available to user-givin people aka certain people (My Admins/Mods)

1 comment

0

you could do something like if game.Players.LocalPlayer.Name == "Player's Name" then

1 answer

First of all, please do not make any requests on this site. Because I am in a good mood, I will help you out. You can do this by checking when a key is down by using the :GetMouse() function.

Local Script that is a child of the GUI:

local admin = {12345, 09876}  -- Replace with the UserIds of the Admins
local keyBind = "q" --replace with the letter you to to keybind
local mouse  = game.Players.LocalPlayer:GetMouse()

for i, plr in pairs(admin) do
	if game.Players.LocalPlayer.UserId == plr then
		mouse.KeyDown:Connect(function(key)
			if string.lower(key) == keyBind then
				script.Parent.Enabled = true
			end
		end)
	end
end

1 comment

0

Use userinputservice instead, mouse.keydown is deprecated, theres also no reason to use a loop for that

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