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

Making a door open on Key1Down event and a gui pops up to show (blank key) to open door?

I want to make a key1down event door and when you got up to the door, it shows the key to open the door like "Press e to open door" in a gui way. Can anyone help me with this problem? Thanks.

2 comments

0

Wait so you make the code for him? He accepts even though KeyDown Event was not included sorry but this feels more like a request.

0

Opinions I tried before.

2 answers

✓ Accepted answer

Put this script in the door

local distanceGUIOpens=10 --Change this to the distance between the door and character you want the gui to stay open
game.Players.PlayerAdded:connect(function(plr)
	repeat wait() until plr.Character
	if (plr.Character.Torso.Position-script.Parent.Position).Magnitude<=distanceGUIOpens then
		if not plr.PlayerGui:FindFirstChild("DoorGui") then
			local gui=Instance.new("ScreenGui")
			local textbox=Instance.new("TextBox")
			gui.Parent=plr.PlayerGui
			gui.Name="DoorGui"
			textbox.Name="DoorGui"
			textbox.Text='Press "E" to open door'
			textbox.Parent=gui
			textbox.BackgroundTransparency=1
			textbox.Position=UDim2.new(0.5,0,0.2,0)
			while wait() do
	if (plr.Character.Torso.Positionscript.Parent.Position).Magnitude>=distanceGUIOpens then
				gui:Remove()
			end
		end
	end
end)

This script should work

1 comment

0

Woops forgot all about the keydown event sorry........................

Code?

2 comments

0

dude i asking a queston, no code ;l

0

I know but, it seems that you are asking for someone to make a code for you. You also said you needed help wich I assume you have an error on your code

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