使用键聚焦时 TextBox 值会发生变化

TextBox value changes when focused on by using a key

我一直在尝试为我的游戏制作一个类似聊天的系统,所以我很自然地使用 / 键来激活它。但是,当我按下该键时,TextBox 的值变为 /。有什么办法可以避免这种情况吗?这是我的代码:

local ChatBar = Player.PlayerGui:WaitForChild("ScreenGui").Frame.BoxFrame.Frame.ChatBar
local CS = game:GetService("ContextActionService")
CS:BindAction("Chat Focus",function()
    ChatBar:CaptureFocus()
    -- I need to add something here...
end,false,Enum.KeyCode.Slash)

尝试

spawn(function()ChatBar:CaptureFocus()end)