How would the event fire when pressing Enter?

Hello. I am trying to make a command bar. I have made this script, but the problem is that I want to execute it when I press enter. But the event fires when i finish to type the word “baseplate”. Any help?
(Local) Script:

local TextBox = script.Parent


TextBox:GetPropertyChangedSignal("Text"):Connect(function()
	local Input = TextBox.Text
	if Input == "baseplate" then
		workspace.Baseplate:Destroy()
	end
end)

I believe the solution is to use a different event from this dev hub tutorial / recipe/code piece using focus lost, which has enter pressed detection in the event:

https://developer.roblox.com/en-us/recipes/Get-Users-to-Input-Text

1 Like