Rotating model the way player faces

  1. What do you want to achieve?
    I want to learn a way to rotate a model the way player faces (without using primaryparts)

  2. What is the issue?
    i don’t know how to rotate model the way player faces.

  3. What solutions have you tried so far?
    I tried looking in devforum and i could only find something with look vector but i don’t know how to rotate model using look vector, i only know how would i make it move the way player faces but not rotate.

for i, Slot in pairs(script.Parent:GetChildren()) do
	if Slot:IsA("TextButton") then
		Slot.MouseButton1Click:Connect(function()
			local AlingedToObject = Slot:FindFirstChild("AlingedToObject")
			local Object = game.ReplicatedStorage.AssetsRS.Constructions:FindFirstChild(AlingedToObject.Value)
			
			local ObjectClone = Object:Clone()
			ObjectClone.Parent = workspace.PreviewStructures
			for i, Part in pairs(ObjectClone:GetDescendants()) do
				if Part:IsA("BasePart") or Part:IsA("MeshPart") then
					Part.CanCollide = false
					Part.CollisionGroup = "none"
					if Part.Transparency <= 0.99 then
					Part.Transparency = 0.75
					end
				end
			end
			while wait(0.25) do
				ObjectClone:PivotTo(CFrame.new(script.Parent.Parent.Parent.Parent.Parent.HumanoidRootPart.Position + script.Parent.Parent.Parent.Parent.Parent.HumanoidRootPart.CFrame.LookVector * 5))
			end
		end)
	end
end

Just use the render service and set its orientation to the players every frame.

i’ve tried doing this a lot of time but it wont work for me for some reasons:

ObjectClone:PivotTo(CFrame.new(script.Parent.Parent.Parent.Parent.Parent.HumanoidRootPart.Orientation))

i also tried using

ObjectClone:PivotTo(script.Parent.Parent.Parent.Parent.Parent.HumanoidRootPart.Orientation)

and i tried using MoveTo() as well.
and as i know RenderStepped only works in local scripts.

Can’t you just do model.orientation? I haven’t done anything of the sorts in a while.

as i know you can’t do it with just model.Orientation because model can’t be rotated like so

CFrames have a Rotation and Position property. If you wanted to make the model face the same way the player does while keeping it in the same spot, you would just multiply the model’s CFrame with the Rotation property of the player’s CFrame:

Model:PivotTo(CFrame.new(Model:GetPivot().Position) * Player.Character:GetPivot().Rotation)
2 Likes

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