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

How can I check if someone opened the developer menu?

Asked by 5 years ago

So I want to add a secret message that prints in the output as an easter egg. I have so far used a linear searching function, but I am not sure how to implement pressing the F9 key into this function.

So far I have used:

local inputservice = game:GetService('UserInputService')

local keyspushed = inputservice:GetKeysPressed()

local function tableContains(tbl, element)
    for _, v in ipairs(element) do
        if (rawequal(v, element)) then
            return true;
        end
    end
    return false;
end

Where do I put my variables? Thanks.

2 answers

Log in to vote
0
Answered by
St_vnC 330 Moderation Voter
5 years ago

Can you not do something like this?

local UIS = game:GetService(“UserInputService”)

UIS.InputBegan:Connect(function(Input, IsTyping)
       If IsTyping == true then return end -- This is optional I use it because it’s really useful
       if Input.KeyCode == Enum.KeyCode.F9 then
             print(“Pressed F9!”) -- Make your Easter egg here
       end
end)
0
I'll try this. Thanks! MuffinZMan_YT 20 — 5y
Ad
Log in to vote
0
Answered by
ryan32t 306 Moderation Voter
5 years ago
Edited 5 years ago

How To Check If A Player Has The Developer Console Open:

~Developer Console Can Only Be Found Through Local Script~

-- Local Script --
local plr = game:GetService("Players").LocalPlayer

local CoreGui = game:GetService("CoreGui")
local DevConsoleMaster = CoreGui:FindFirstChild("DevConsoleMaster")
local MainView = DevConsoleMaster:FindFirstChild("MainView",true)

if MainView then
    print(plr.Name .. " has the Developer Console Open")
end

--[[

Note: MainView is only an existing instance when Developer Console is opened.

--]]

Answer this question