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

How to set position of model?

I made a script, it is for custom inventory picking up. When you go over an item it clones itself, goes to backpack, then removes itself... when equipping the item if you press the P button it clones itself to workspace, and removes itself. Unfortunately, I don't know how to set the model's position relevant to the player's! Here is my script

local tool = script.Parent
tool.Equipped:connect(function(mouse)
    mouse.KeyDown:connect(function(key)
        if key == "p" then
            local gitem = game.ReplicatedStorage.Pitchforkitem:clone()
			gitem.Parent = workspace
			gitem.Position = script.Parent.Parent.Torso.Position -- this part
			script.Parent:remove()
        end            
    end)
end)

Please help!!! Thank you!!!

1 answer

✓ Accepted answer
Model:MoveTo(Vector3 position)

This will teleport the model to the given position. If there are any obstructions in the way of that position then Roblox will automatically place the model on top of them.

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