Why are my ore models spawning sideways?

I have a randomized ore spawning system, however, the issue is that the ores are spawning on their sides… I’ve tried turning the part responsible for the location of where the ores will spawn, but to no avail… Any help would be most appreciated! Below you’ll find the code that I’ve been having issues with, and pictures of how the ore is supposed to look like as well as the sideways positioning that the ores are currently at.

Serverscript snippet that deals with spawning the ores.

if Ore == "Rock" then
			local rockClone = Ores[1]:Clone()
			rockClone.Parent = FoundLocation
			rockClone:PivotTo(FoundLocation.CFrame)
			rockClone.Parent.Occupied.Value = true
		elseif Ore == "IronOre" then
			local ironClone = Ores[2]:Clone()
			ironClone.Parent = FoundLocation
			ironClone:PivotTo(FoundLocation.CFrame)
			ironClone.Parent.Occupied.Value = true
		elseif Ore == "GoldOre" then
			local goldClone = Ores[3]
			goldClone.Parent = FoundLocation
			goldClone:PivotTo(FoundLocation.CFrame)
			goldClone.Parent.Occupied.Value = true
		elseif Ore == "AzureOre" then
			local azureClone = Ores[4]:Clone()
			azureClone.Parent = FoundLocation
			azureClone:PivotTo(FoundLocation.CFrame)
			azureClone.Parent.Occupied.Value = true

How it’s supposed to look
image

How it’s spawning as
image

2 Likes

I forgot to include this, but here’s the foundlocation variable that the snippet of code is referencing.

		local Index : number = math.random(#spawnBricks)
		local Chosen : Part = spawnBricks[Index]
		local FoundLocation = Spawns:FindFirstChild(Chosen.Name)
1 Like

Have you checked if the primary part of the models has the proper orientation?

How would I check the primary part of a model?

You could turn on the orientation indicator and check if its facing up or down. If the parts responsible for setting the spawn location are fine as you said in the post then it may be that the primary part of the models is incorrect, leading to :PivotTo to rotate the rest of the model incorrectly.

Thank you! It was not setting a primary part which caused the tilted ore.

1 Like

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