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

model moveto not working how i want it to?

I want the house to duplicate to the position of the slot but if there is a player where the house will duplicate then the house will be floating above where the players head is. How do i stop this?

		local newhouse = casas.Casa1Left:Clone()
		newhouse.Name = "clonedhouse"
newhouse.Parent = this
newhouse:MoveTo(Vector3.new(this.Position.X,this.Position.Y,this.Position.Z))
	elseif this.houseval.Value == 2 then
		this.hashouse.Value = true
		local newhouse = casas.Casa2Left:Clone()
		newhouse.Name = "clonedhouse"
newhouse.Parent = this

1 answer

That's because MoveTo() tries to find an empty space for the model, just like setting a part's Position.

And same as in parts, if you set CFrame instead, it will not do that.

So, what you need to do is use SetPrimaryPartCFrame() function of the model, but first set its PrimaryPart in properties!

	local newhouse = casas.Casa1Left:Clone()
	newhouse.Name = "clonedhouse"
	newhouse.Parent = this
	newhouse:SetPrimaryPartCFrame(this.CFrame)
elseif this.houseval.Value == 2 then
	this.hashouse.Value = true
	newhouse.Name = "clonedhouse"
	newhouse.Parent = this

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