How should I fix this position issues?

Here’s the image of my game when I create rock on the roof or smth , the position dosent fit .

			local Rock ="Part",workspace.Effects.Low)
			local RNumber = math.random(3,4)
			Rock.Size =,RNumber,RNumber)
			Rock.CFrame = newCFrame * CFrame.Angles(0,math.rad(angle),0) *,0,-7.5)
			Rock.Orientation =,180),math.random(-180,180),math.random(-180,180))
			Rock.Anchored = true
			Rock.CanCollide = false

			Rock.Color = Raycast.Instance.Color
			Rock.Material = Raycast.Material

				game.TweenService:Create(Rock,,{CFrame = Rock.CFrame *,-7.5,0)}):Play()
				game.TweenService:Create(Rock,,{Transparency = 1}):Play()
			angle += 360/16
1 Like

We need more details.

Character Limit

You need to take into account Raycast.Normal to rotate the parts.

local rotateCf =, fwdVector, Raycast.Normal)
Rock.CFrame = rotateCf * CFrame.Angles(0,math.rad(angle),0) *,0,-7.5)

Where fwdVector must not have the same direction as Raycast.Normal, you could pick two vectors like Vector3.xAxis and Vector3.yAxis and pick the first one whose direction is not the same as the normal.

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