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

(Answered) How do I get rid of slash in custom chat's chat bar?

I open my custom chat's chat bar and whatever I type starts with "/". How do I stop the slash from proceeding everything I type so I may go straight to typing into the chat rather than have to backspace the slash out?

local chatInput = script.Parent:WaitForChild("ChatInput")
local uis = game:GetService("UserInputService")
local onChatInputted = game.ReplicatedStorage:WaitForChild("OnChatInputted")
local cooldown = 1
local isCoolingDown = false

uis.InputBegan:Connect(function(key, gameProcessed)		
	if key.KeyCode == Enum.KeyCode.Slash and not gameProcessed then			
		chatInput:CaptureFocus()		
	end
end)

chatInput.FocusLost:Connect(function(enterPressed)
	if not enterPressed then return end	
	local input = chatInput.Text	
	chatInput.Text = ""	

	if string.len(input) > 0 then		
		if isCoolingDown == true then 			
			chatInput.Text = "Wait for cooldown to end!"			
			return 		
		end		
		isCoolingDown = true		
		onChatInputted:FireServer(input)		
		wait(cooldown)			
		isCoolingDown = false	
	end	
end)

1 answer

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