i am making this Plugin for adonis but when i run it it gives unspecified error heres the script
server = nil -- Mutes warnings about unknown globals service = nil return function() server.Commands.ExampleCommand = { Prefix = server.Settings.Prefix; -- Prefix to use for command Commands = {"map"}; -- Commands Args = {"arg1"}; -- Command arguments Description = "Example command"; -- Command Description Hidden = false; -- Is it hidden from the command list? Fun = false; -- Is it fun? AdminLevel = "Players"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas") Function = function(plr,args) -- Function to run for command --where my script starts-- local a = (tostring(args[1])) print (a) game.ServerStorage.a:Clone().parent = game.Workspace end } end
any help will be appreciated
There is a problem on line 18 of your code. Since "a" is a string and not an object value the script cannot read it as an object value also if you typed in the wrong map name it will give you an error stating that the map isn't found. Here is a fix for it:
local a = tostring(args[1]) if game.ServerStorage:FindFirstChild(a) then -- Check if the map is there game.ServerStorage[a]:Clone().Parent = workspace -- Clones the map in workspace! end