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

Why does position not go to the position i set it to?

Asked by
Prioxis 673 Moderation Voter
10 years ago

heres my script

M16 = game.Lighting.Items.MillitaryWeapons.M16
spawn = {M16}
while wait() do
Spawns = spawn[math.random(1, #spawn)]
Spawns:Clone().Parent = game.Workspace
Spawns.Position = Vector3.new(script.Parent.Position)
wait(300)
end

why does the position go to the exact location?

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

Spawns:Clone().Parent parents a clone of Spawns. Then, when you set Spawns.Position you are not referring to that clone.

M16 = game.Lighting.Items.MillitaryWeapons.M16
spawn = {M16}
while wait() do
    Spawns = spawn[math.random(1, #spawn)]
    Spawns = Spawns:Clone();
    Spawns.Parent = game.Workspace
    Spawns.Position = script.Parent.Position
    wait(300)
end
Ad

Answer this question