Model randomly rotating when cloned?

  1. What do you want to achieve? I have a script that clones a model.

  2. What is the issue? It randomly changes the orientation without me telling it to.

  3. What solutions have you tried so far? Re-did the entire cloning method, and there’s no errors so idk what to do.

script for spawning the pirate ships

function spawnPirateShips(number)
	for count = 1, number do
		local PirateShipClone = PirateShip:Clone()
		PirateShipClone.Parent = game.Workspace
		PirateShipClone:SetPrimaryPartCFrame(CFrame.new(CurrentPosX - 12000, 28.343, CurrentPosZ - 6000))
	end
end

script at the bottom that calls the function

for count = 1,2 do
	wait(0.5)
	spawnPirateShips(3)
end

Can we see a video if that’s possible?

1 Like

unknown (18)
Image of what the actual model is like (when I stopped testing it and placed it into the world)

unknown (17)
Image of it when I test the game

I would send a video but my recorder stopped working

If you’re setting the PirateShipClone to a CFrame and not multiplying it, it will orient back to the original orientation. Here’s an easy fix:

PirateShipClone:SetPrimaryPartCFrame(CFrame.new(CurrentPosX - 12000, 28.343, CurrentPosZ - 6000) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)))

Keep orientating the values by 90 if it’s in the wrong orientation.

Ex: 90, 180, 270, 360

2 Likes