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

Im getting the error No method name passed in __namecall for Object. Whats wrong?

Help with the code problem

While restime do
local placemap = Choose.Clone()
placemap.Parent  = game.Workspace
placemap.Position = Vector3.new (x, y, z)
wait (10)
end

5 comments

0

Format your code correctly in Lua Code block, please.

0

sorry about this the code looks weird

1

lol you don't need a codeblock for every line

1

I just signed up.... XD

0

__namecall refers to a pathway and/or naming problem. I am assuming its trying to find 'Chose' before its loaded

1 answer

The problem is that you indexed the Clone function, rather than invoking it directly with a method. The normally defaulted self argument was not passed.

In other words, object:Clone(); is the same as object.Clone(object);.

Here's an example of how that works:

local world = {
	Bob = {
		Name = "Bob";
		SayHello = function(self)
			print(self.Name.. " said hello!");
		end
	}
}

world.Bob:SayHello(); --> Bob said hello!

world.Bob.SayHello(); -->attempt to index local 'self' (a nil value)

world.Bob.SayHello(world.Bob); --> Bob said hello!

Also, due to how Roblox handles property listeners, you should set placemap's Parent after configuring the Position Property - read more here.


while restime and wait(10) do
	local placemap = Choose:Clone() --Invoke with ':' !
	placemap.Position = Vector3.new(x, y, z)
	placemap.Parent  = workspace --Parent afterwards !
end

4 comments

0

thanks for the help!

1

No problem ;D Remember to accept my answer to ensure we both get reputation we deserve

0

Just in case, up-votes for the lovely answer and question!

0

Muchos gracias ;D

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