首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >roblox通知切换

roblox通知切换
EN

Stack Overflow用户
提问于 2021-08-29 22:21:29
回答 2查看 60关注 0票数 0

我正在尝试使用以下规则切换通知:(顺便说一下,这是ROBLOX )

比方说,如果我按"f“,即使我按"e”或"r“,通知也不会弹出,除非我再次按"f”,然后如果我按"e“或"r”,通知将会显示。有什么想法吗?

代码语言:javascript
运行
复制
local KeyBindHigh = "e"
local KeyBindLow = "r"

game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(Key)
    if Key == KeyBindHigh then 
                size = size + change
                game.StarterGui:SetCore("SendNotification", {
                Title = "~ BlackRose ~";
                Text = "Reach set to " .. size;
                Icon = "";
                Duration = 1;})
        end
    if Key == KeyBindLow then 
                size = size - change
                game.StarterGui:SetCore("SendNotification", {
                Title = "~ BlackRose ~";
                Text = "Reach set to " .. size;
                Icon = "";
                Duration = 1;})
        end
end)
EN

回答 2

Stack Overflow用户

发布于 2021-09-02 18:05:50

代码语言:javascript
运行
复制
local KeyBindHigh = "e"
local KeyBindLow = "r"

game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(Key)
    if Key == KeyBindHigh then 
                size = size + change
                game.StarterGui:SetCore("SendNotification", {
                Title = "~ BlackRose ~";
                Text = "Reach set to " .. size;
                Icon = "";
                Duration = 1;})
    elseif Key == KeyBindLow then 
                size = size - change
                game.StarterGui:SetCore("SendNotification", {
                Title = "~ BlackRose ~";
                Text = "Reach set to " .. size;
                Icon = "";
                Duration = 1;})
    end
end)

试试这样的东西。这可能是因为您有if语句。这应该是可行的。

票数 0
EN

Stack Overflow用户

发布于 2021-09-02 22:43:51

如果我没理解错的话,这就是你想要的:

代码语言:javascript
运行
复制
local KeyBindHigh = "e"
local KeyBindLow = "r"
local KeyBindSuspend = "f"

local changeSuspended = false 

game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(Key)
    if Key == KeyBindSuspend then
        changeSuspended = not changeSuspended
        print ("changeSuspended = " .. tostring(changeSuspended))
        return
    end
    if changeSuspended then return end
    
    if Key == KeyBindHigh then 
        size = size + change
        game.StarterGui:SetCore("SendNotification", {
            Title = "~ BlackRose ~";
            Text = "Reach set to " .. size;
            Icon = "";
            Duration = 1;})
    elseif Key == KeyBindLow then 
        size = size - change
        game.StarterGui:SetCore("SendNotification", {
            Title = "~ BlackRose ~";
            Text = "Reach set to " .. size;
            Icon = "";
            Duration = 1;})
    end
end)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68977360

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档