So this uses adonis’s custom commands to run basically as a function.
Args == arguments
Args 1 is the number so the first thing you type :turret 1 (The first argument args[1] would be 1.)
Args 2 is the bool value so if the arg is true or false.
Hopefully that’ll help you understand the script a little more.
If not these two talk about what adonis is: The bottom one talks more in depth about custom commands than my one.
The code:
turret = {
Prefix = Settings.Prefix;
Commands = {"turret"};
Args = {"number", "operation"};
Description = "Number = 1-3 and Operation = true/false | Control the turrets.";
AdminLevel = 90;
Filter = true;
Hidden = false;
Function = function(plr, args, data)
if args[1] ~= "1" or args[1] ~= "2" or args[1] ~="3" then
warn("Turret cannot be located, make sure you chose a number from 1 to 3.")
end
if args[1] == "1" or args[1] == "2" or args[1] == "3" then
warn("Turret Located")
if args[2] == "true" then
if args[1] == "1" then
local target = game.workspace.Turret1
target.Online = true
print("Turning turret 1 online")
end
end
if args[2] == "true" then
if args[1] == "2" then
local target = game.workspace.Turret2
target.Online = true
print("Turning turret 2 online")
end
end
if args[2] == "true" then
if args[1] == "3" then
local target = game.workspace.Turret3
target.Online = true
print("Turning turret 3 online")
end
end
if args[2] == "false" then
if args[1] == "1" then
local target = game.workspace.Turret1
target.Online = false
print("Turning turret 1 offline")
end
end
if args[2] == "false" then
if args[1] == "2" then
local target = game.workspace.Turret2
target.Online = false
print("Turning turret 2 offline")
end
end
if args[2] == "false" then
if args[1] == "3" then
local target = game.workspace.Turret3
target.Online = false
print("Turning turret 3 offline")
end
end
end
end,
};
The error
Other information