Unable to change position of model (please help)

HI I want to clone and move a model to a another objects position but I have been unable to get the script to teleport my object, there are no errors reported when the script is ran. I have tried MoveTo(), SetPrimaryPartCFrame() but they haven’t worked, I have also looked around the dev forum but all the answers I found did not work.

the local script is attempting to clone a model and spawn it at another part’s cframe when a button is clicked

local Top = script.Parent.Parent
local Other = script.Parent.Parent.Parent
local TowerSpawn = workspace:WaitForChild("Tower").CFrame.Position
local Build = workspace.Exploadables.Ready.CobbleTower:Clone()
script.Parent.MouseButton1Click:Connect(function()
	Top.Green.Enabled = true Top.Red.Enabled = false
	
	Build:SetPrimaryPartCFrame(CFrame.new(TowerSpawn))
	
	
	
	if workspace:FindFirstChild("LightHouse") then 
		workspace:FindFirstChild("LightHouse"):Destroy() 
	end

	if workspace:FindFirstChild("CassicHouse") then 
		workspace:FindFirstChild("ClassicHouse"):Destroy() 
	end
end)

Other.LightHouse.Play.MouseButton1Click:Connect(function()
	Top.Green.Enabled = false Top.Red.Enabled = true
end)

Other.HappyHouse.Play.MouseButton1Click:Connect(function()
	Top.Green.Enabled = false Top.Red.Enabled = true
end)

It appears to me that you are forgetting to parent the cloned CobbleTower to workspace. An object that has been cloned has a nil parent by default until you assign it.

SetPrimaryPartCFrame is also deprecated and I would not recommend using it in new code. I advise that you use Model:PivotTo() instead. (Remember to set your PrimaryPart, otherwise this function will not work)

I hope this helps! :slightly_smiling_face:

1 Like

Thank you so much your a life saver!!

1 Like

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