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

How do I fix this model positions with a script?

When I clone a model and change its position to a part's, the pivot point is at the part but not the model, how do i fix?

Here is my script:

local RS = game:GetService("ReplicatedStorage")

local enemiesFolder = RS.Enemies
local enemySpawn = workspace.EnemySpawns:GetChildren()
local moveToParts = workspace.MoveToParts:GetChildren()

local randomSpawn = enemySpawn[math.random(1, #enemySpawn)]
local randomMoveToPart = moveToParts[math.random(1, #moveToParts)]

local function Round1()
	
	local Round1Enemy = enemiesFolder.Enemy1:Clone()
	Round1Enemy.Parent = workspace.Enemies
	Round1Enemy.HumanoidRootPart.Position = randomSpawn.Position
	Round1Enemy.Humanoid:MoveTo(randomMoveToPart.Position)
	
end

while wait(5) do
	Round1()
end

Thanks for the help! -KoalaKrush

1 answer

I ensured the model is unanchored and welded With the exception of HumanoidRootPart HumanoidRootPart can remain anchored I needed to use Model:PivotTo()

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