所以,我有一个BindableEvent需要使用,但当角色重置时,该事件不能再使用。我怎样才能使它在重置后也能正常工作呢?这是我的代码。
local CS=game:GetService("ContextActionService")
local Player=game:GetService("Players").LocalPlayer
CS:BindAction("Chat Focus",function()
spawn(function() ChatBar:CaptureFocus() end)
ChatBar.PlaceholderText = ""
end,false,Enum.KeyCode.Slash)
Player.Character:WaitForChild("Humanoid").Died:Connect(function()
repeat wait(0.01) until Player.Character
CS:BindAction("Chat Focus",function()
spawn(function() ChatBar:CaptureFocus() end)
ChatBar.PlaceholderText = ""
end,false,Enum.KeyCode.Slash)
end)
希望能得到帮助 :D
如果你把你的BindAction命令放到StarterGUI文件夹中,它就会工作。你甚至不需要一个Died事件处理程序。