Model not moving to correct location when primary part is moved

I’m trying to make a grenade that spawns a model at a certain point and I tried to do this by moving its primary part to said point
instead the model just goes to 1 specific place and I don’t know why
the cloned models go to where the original model’s position would be in workspace (its in replicated storage)


tool = script.Parent
tool.Activated:Connect(function()
	local clone = game.ReplicatedStorage.he:Clone()
	clone.Handle.Position = tool.modle.tart.Position
	clone.Parent = game.Workspace
end)
1 Like

move it to the RightHand instead

Try using MoveTo() instead. Also make sure your clone has a set PrimaryPart

tool = script.Parent
tool.Activated:Connect(function()
	local clone = game.ReplicatedStorage.he:Clone()
	clone:MoveTo(tool.modle.tart.Position)
	clone.Parent = game.Workspace
end)

Setting the Position of the Handle will not Move the Entire Model, It would only Move the Part itself, use PivotTo (The successor to SetPrimaryPartCFrame) if you want to use CFrame, and MoveTo (not Humanoid:MoveTo) if you want to use Vector3 (like what @realmhopping said).

What these functions do is Position the Model with the given Data

-- Deprecated version (SetPrimaryPartCFrame)

-- Get / Set PrimaryPartCFrame are Deprecated and 
-- have been Superceded by 'PivotTo', but it is
-- best that we look at how they are applied

local CF = model:GetPrimaryPartCFrame()
model:SetPrimaryPartCFrame(CF * CFrame.Angles(math.pi/2, 0, 0))

-- PivotTo

-- PivotTo does not require a PrimaryPart to function
-- but its best if you Apply one so it can apply the
-- CFrame Properly

local CF = model:GetPivot()
model:PivotTo(CF * CFrame.Angles(math.pi/2, 0, 0))

-- MoveTo

-- MoveTo (Not Related to Humanoid:MoveTo)
-- Will Position the Model using a Vector3
-- value, This works, but its recommended
-- that you use 'PivotTo' Instead of 'MoveTo'
-- due to overall being better 

model:MoveTo(Vector3.one)

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.