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

How would I be able to put this object's position near player?

elseif args[1] == "Insert" then
    local Item = game:GetService("InsertService"):LoadAsset(args[2])
    local get = Item:children()
    for i = 1, #get do
        get[i].Parent = workspace.InsFolder
        get[i]:SetPrimaryPartCFrame(plr.Character.Torso.Position)
        wait()
    end
    end
end

I'm trying to create an insert command and I'm curious how would I set the object's position near the player and it works and all just not able to set its position near the player I think it's because the object possibly doesn't contain a primary part what can I do? (Args = cmd:split(" "))

1 answer

✓ Accepted answer

You’re casting a Vector3 when SetPrimaryPartCFrame is expecting a CFrame datatype. The method SetPrimaryPartCFrame will raise an exception if the Instance the function is called on has no PrimaryPart, therefore if this is not your case, you should know.

get[i]:SetPrimaryPartCFrame(plr.Character.HumanoidRootPart.CFrame)

Pass the HumanoidRootPart for Character Rig Support.

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