Roblox游戏自动检测器



我正在制作一个gui,它会自动检测我们在哪个游戏中。唯一的问题是,如果你在一个游戏中,它不支持它应该踢你,并留下一个消息

if game.GameId == "301549746" then
btxt.Text = "Game detected, Counter-Blox"
end
if game.GameId == "137877687" then
btxt.Text = "Game detected, Rociticens"
end
if game.GameId == "286090429" then
btxt.Text = "Game detected, Aresenal"
end
if else 
game.Players.LocalPlayer:Kick("game not supported");
end 

由于某些原因,我不能在这种情况下使用else它只是下划线"else"红色,然后不会运行

你应该使用elseif,这样语句只运行一次,else关键字必须放在语句结束前

当你编写嵌套if时,你可以使用elseif。它类似于后面跟着if的else,但它避免了需要多个结尾:

https://www.lua.org/pil/4.3.1.html

最新更新