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

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

Asked by 7 years ago
Edited 7 years ago

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
0
Format your code correctly in Lua Code block, please. Goulstem 8144 — 7y
0
sorry about this the code looks weird xxUmbreonDarkxx 6 — 7y
1
lol you don't need a codeblock for every line Goulstem 8144 — 7y
1
I just signed up.... XD xxUmbreonDarkxx 6 — 7y
0
__namecall refers to a pathway and/or naming problem. I am assuming its trying to find 'Chose' before its loaded Bellyrium 310 — 7y

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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
0
thanks for the help! xxUmbreonDarkxx 6 — 7y
1
No problem ;D Remember to accept my answer to ensure we both get reputation we deserve Goulstem 8144 — 7y
0
Just in case, up-votes for the lovely answer and question! Bellyrium 310 — 7y
0
Muchos gracias ;D Goulstem 8144 — 7y
Ad

Answer this question