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

How do I give a cloned model a position?

Asked by 4 years ago

the script i made below clones a model that looks like money and is supposed to give it a position to the spawn part of where it should clone to but it clones to the points (0,0,0)

local position = Vector3.new(script.Parent.Parent.Spawn.Position)

script.Parent.ClickDetector.MouseClick:Connect(function()
    local newMon = game.ReplicatedStorage.Money:Clone()
    newMon.Parent = workspace
    newMon:SetPrimaryPartCFrame(CFrame.new(position))
end)

0
To be clear, is this a local or global script? CowboySprite 5 — 4y
0
global User#29785 0 — 4y
0
Alright, thanks, I'll look at it a bit. CowboySprite 5 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

A Part's Position property returns a Vector3, so basically on the first line you are converting a Vector3 to a Vector3, and it results in the coordinates (0, 0, 0).

Ad

Answer this question