roblox lua通知切换



我试图用以下规则来切换通知:(这是ROBLOX LUA BY the WAY)

假设我按下"f"即使我按下&;e"或";r"除非我按下"f",否则通知不会弹出。再一次,如果我按下& & &;或";r"将显示通知。什么好主意吗?

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)
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语句。这应该可以工作。

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

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)

最新更新