Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by 9 years ago

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.

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. HexC3D 830 — 9y
0
Opinions I tried before. GreekGodOfMLG 244 — 9y

2 answers

Log in to vote
-2
Answered by 9 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your 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

0
Woops forgot all about the keydown event sorry........................ 73epic311 13 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Code?

0
dude i asking a queston, no code ;l GreekGodOfMLG 244 — 9y
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 CMVProduction 25 — 9y

Answer this question