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

How can this code not work!?

Hello, I tried to make a method function for workspace to make a part in and put in "()" its name. What is wrong? It asks me in line 6 for an object literally for no reason I can think of.

** Workspace.Script:6: bad argument #3 to 'Workspace' (Object expected, got table)**

game.Workspace = {
	MakePart = function(n)
		local a = Instance.new("Part", game.Workspace)
		a.Name = n
	end
}
game.Workspace:MakePart("Explantation, anyone?")

1 answer

Try this:

function MakePart(n)
local a = Instance.new("Part", workspace)
a.Name = n
end
MakePart("This Should Work!")

1 comment

0

No, I mean, it should a function of workspace, like game.Workspace:FindFirstChild()

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