当文本框被按键聚焦时值会改变

我一直在试图为我的游戏制作一个类似于聊天的系统,因此我自然使用"/"键来激活它。然而,当我按下该键时,文本框的值变成了"/"。有没有办法可以避免这种情况?以下是我的代码:

local ChatBar = Player.PlayerGui:WaitForChild("ScreenGui").Frame.BoxFrame.Frame.ChatBar
local CS = game:GetService("ContextActionService")
CS:BindAction("Chat Focus",function()
    ChatBar:CaptureFocus()
    -- 在这里我需要添加一些内容...
end,false,Enum.KeyCode.Slash)
点赞
用户1296374
用户1296374

尝试

spawn(function()ChatBar:CaptureFocus()end)
2020-05-04 23:47:14