Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

roblox Adonis map load script gives unspecified error; anyone know whats wrong?

Asked by 6 years ago
Edited 6 years ago

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

0
What line is the error on? It might have something to do with the fact that server is nil. Also, Parent is spelt with a capital P. UgOsMiLy 1074 — 6y
0
i dont know what line the error is on it doesent say ForgotenR4 68 — 6y

1 answer

Log in to vote
0
Answered by
iRexBot 147
6 years ago

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
0
thanks dude that fixed it ForgotenR4 68 — 6y
Ad

Answer this question