Roblox脚本进入对话聊天

Roblox script to enter dialog chat

我需要一个脚本,这样当您在键盘上按 E 时,它会打开与 npc 的聊天我已经在我的头部中有了我想要使用的对话框。我也已经有了用于检测何时按 E 的代码。

game:GetService("UserInputService").InputEnded:Connect(function(input,event)
    if input.KeyCode == Enum.KeyCode.E then
        print("Activated")
        workspace.NPC.Head.Dialog.InUse = true --This is the code I expect to open up the dialog.
    end
end)
game:GetService("UserInputService").InputEnded:Connect(function(input,event)
    if input.KeyCode == Enum.KeyCode.E then
        print("Activated")
        workspace.NPC.Head.Dialog.SomeGui.Visible= true -- example
    end
end)