Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

2 comments

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.

0

i dont know what line the error is on it doesent say

1 answer

✓ Accepted answer

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

1 comment

0

thanks dude that fixed it

This discussion is preserved as it was. New answers, comments, and votes are closed.