I run a server for me and my friends, and we like to jump from gamemode to gamemode often. How would I make sandbox addons only load in sandbox, battle royale mods only in battle royale, ttt only in ttt, etc. ?
You could use engine.ActiveGamemode.
Putting:
local gmName = engine.ActiveGamemode()
if (gmName ~= "sandbox") then
return
end
at the start of your script will prevent it from running on a gamemode that isn't sandbox.
Thanks man! I'm pretty dumb when it comes to coding, so how would I go about making it check through a list of gamemodes? Like it would run if it's either sandbox or ttt?
Use a table.
local Gamemodes = {
["gamemode name"] = true,
}
if not Gamemodes[engine.ActiveGamemode()] then return end
Thanks!
Sorry, you need to Log In to post a reply to this thread.