How to make commandbar command

But how does this make a command?

well it doesnt make a “command,” instead its just for code execution through studio’s command bar, at least assuming plugin’s script level is equal to it
if you’re making preset commands, you can use UserInputService to check if the user pressed enter, or you can add an “execute” button or something to your ui

I don’t have any UI to add any buttons to. I am trying to do it with the Roblox Studio Commandbar.

then just try using userinputservice, you can check if a player pressed enter by doing this:

local UserInputService = game:GetService('UserInputService')
local inputCon = nil
inputCon = UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Return then
		-- this is enter
		inputConn:Disconnect()
		inputConn = nil
	end
end)

So how would I check if they are focusing on the commandbar?

id suggest reading into the following documents:
the service commandbar is under: ScriptEditorService
commandbar’s class/instance: ScriptDocument
you could check when the output has a new entry considering a new message always appear whenever the player uses the commandbar: LogService

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.