Hello! I am scripting a custom Adonis command using its server-side plugin feature. This is a ModuleScript, and the command is intended to change a BoolValue to turn a light on/off. However, this does not function properly.
When I pass the argument “false” in the command, the BoolValue always gets set to true despite a print() statement confirming that the argument was detected as “false”.
This is the ModuleScript. Line 15 sets the BoolValue to args[2], which in the command is either “true” or “false”.
server = nil -- Mutes warnings about unknown globals
service = nil
return function()
server.Commands.HoldingLights = {
Prefix = server.Settings.Prefix; -- Prefix to use for command
Commands = {"holdlight"}; -- Commands
Args = {"station","state"}; -- Command arguments
Description = "Change the state of holding lights at stations that have it."; -- Command Description
Hidden = false; -- Is it hidden from the command list?
Fun = false; -- Is it fun?
AdminLevel = "Admins"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
Function = function(plr,args) -- Function to run for command
if game.Workspace.Technology.HoldingLights:FindFirstChild(args[1]) ~= nil then
if (args[2] == "true") or (args[2] == "false") then
game.Workspace.Technology.HoldingLights[args[1]].State.Value = args[2]
print(plr.Name .. " set holding light " .. args[1] .. ", state to " .. args[2])
end
end
end
}
end
I have another script that reacts to a change in the BoolValue, and it detects that it always gets set to true when I type “false”. I have confirmed this for myself by looking at Value in the Explorer.
Here is a screenshot of me executing the command with “false” as the second argument. This is what the BoolValue should be set to.
Here is a screenshot of the BoolValue Value after executing the command. This was initially false, but was set to true by the command for some reason. The same occurs when it is initially true.
I have already checked over the ModuleScript multiple times and I have been unable to conclude that there is a mistake. It is possible that this is a bug, but I may just be skipping over a crucial mistake.