当我在聊天时按“M”键时出现了我的GUI界面
2021-5-21 13:6:55
收藏:0
阅读:158
评论:2
好的,所以我有一个问题。我有一个Webhook报告GUI和脚本,按M键打开。但当我在输入时按M键,它会打开GUI。我该怎么解决?它的功能完美,只是在输入时按“M”键会打开GUI。
local key = Enum.KeyCode.M -- 如果需要,更改键
local gui = script.Parent.main -- 主框架
local plr = game.Players.LocalPlayer -- 获取本地玩家
local UIS = game:GetService("UserInputService") -- 获取服务
gui:TweenPosition(UDim2.new(0.382, 0, 1.229, 0))
UIS.InputBegan:Connect(function(Input)
if Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == key then --用户按键
if gui.Position == UDim2.new(0.382, 0, 0.229, 0) then --如果打开
gui:TweenPosition(UDim2.new(0.382, 0, 1.229, 0)) --关闭UI
else --已关闭
gui:TweenPosition(UDim2.new(0.382, 0, 0.229, 0)) --打开UI
end
end
end)
local sendbtn = script.Parent.main.send --- 发送按钮
local message = script.Parent.main.messageinput -- 消息框
local repstorage = game:WaitForChild("ReplicatedStorage")
local send = repstorage.reportevents.send
local sendcheck = false -- 防止发送按钮被刷屏多次
local cooldowntxt = script.Parent.main.cooldown
cooldowntxt.Visible = false
---- DISCORD WEBHOOK CONFIG IS IN SERVERSCRIPTSERVICE (report)
sendbtn.MouseButton1Click:Connect(function()
if sendcheck == false then --检查是否最近已发送
sendcheck = true
send:FireServer(message.Text, sendcheck) --从客户端发送到服务器(serverscriptservice)
sendbtn.Text = "Sent!" -- 自定义您想要的样式
wait(0.7)-- 自定义您想要的样式
sendbtn.Text = "A staff member will be with you soon!"-- 自定义您想要的样式
wait(1.5)-- 自定义您想要的样式
sendbtn.Text = "Send"-- 自定义您想要的样式
cooldowntxt.Visible = true
wait(70)-- 自定义您想要的样式
sendcheck = false
cooldowntxt.Visible = false
end
end)
print("配置已加载")
点赞
用户16061697
检查当按下“m”键时,用户是否在输入(我知道你可以做到,但我不太确定如何实现)。
2021-05-29 16:32:58
评论区的留言会收到邮件通知哦~
推荐文章
- Lua 虚拟机加密load(string.dump(function)) 后执行失败问题如何解决
- 我想创建一个 Nginx 规则,禁止访问
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?

UserInputService.InputBegan 信号 有一个名为
gameProcessedEvent的第二个参数,它可以让你知道动作是否已经被游戏引擎内部处理过。当你通常使用该动作时,
gameProcessedEvent将为false,当你在聊天中输入时,它将为true。你可以使用这个来决定何时显示你的菜单或不显示。UIS.InputBegan:Connect(function(Input, gameProcessedEvent) -- 在用户正在聊天中输入时退出 if gameProcessedEvent then return end if Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == key then -- 用户按下键 if gui.Position == UDim2.new(0.382, 0, 0.229, 0) then -- 如果已打开 gui:TweenPosition(UDim2.new(0.382, 0, 1.229, 0)) -- 关闭 UI else -- 关闭状态 gui:TweenPosition(UDim2.new(0.382, 0, 0.229, 0)) -- 打开 UI end end end)