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

How would I make a gui only appear to certain people when they press a certain key?

BAsically what i'm trying to do is make a GUI appear to people when they press a key (Z) and disappear when they press the key as well. However, I only want it to appear for certain people.

I already have a keyDown scripted, but I don't know where to start for making a GUI disappear and reappear, so if anyone can direct me to some sources I could be grateful.

1 comment

0

Instead of using KeyDown which is deprecated(shouldn't be used anymore) use this http://wiki.roblox.com/index.php?title=API:Class/UserInputService

2 answers

All you really have to do is give the gui to certain people (place it in there playergui folder I think) with the keyDown script inside of the gui, so just use something basic to go through the list of people and distribute the gui.

Put this into a SCRIPT, Fill in the script, then you're all set!

local player = game.Players.LocalPlayer

function clicked(Key)
	if Key == "z" and player.Name == "AltLaserthrasher1" then
		game.Players.LocalPlayer.PlayerGui.GUINAME.FrameName.Visible = true
	end
end
game.Players.LocalPlayer:GetMouse().keyDown:connect(clicked)

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