How to fix character rotation on tower placement

Let me get straight to the point, The tower rotates differently when the player is in the state of placing:

Preview:
https://gyazo.com/f7671e2b21a18d49b5e18f0f30fd2b73

Current Code:

script.Parent.MouseButton1Click:Connect(function()
	if PlayerTowers == nil then return end
	
	if isPlacing == false then
		isPlacing = true
		
		local TowerPreview = PlayerTowers:WaitForChild(ViewportFrame.Name)
		towerBeingPlaced = TowerPreview:Clone()
		towerBeingPlaced.Parent = workspace
		Mouse.TargetFilter = towerBeingPlaced

		PlacingEvent = RunService.RenderStepped:Connect(function(delta)
			towerBeingPlaced.Level1.HumanoidRootPart.CFrame = Mouse.Hit + Vector3.new(0,0.5,0)
			
		end)
	elseif isPlacing then
		PlacingEvent:Disconnect()
		towerBeingPlaced:Destroy()
		isPlacing = false
	end

end)

I tried using CFrame.new() and using CFrame.Angles but I can’t get the rotation properly :man_shrugging:

Mouse.Hit returns a CFrame, to solve this you will need to get its position:

towerBeingPlaced.Level1:PivotTo(CFrame.new(Mouse.Hit.Position))
3 Likes

I forgot to clear this yesterday since a person in my dm’s help fix it but ty too

1 Like