I’m trying to make a part face the player only by the X axis. But this script faces the part at the player by X, Y, and Z. How can I make it face the player only by the X axis?
Script:
local TweenService = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local Character = game.Workspace:WaitForChild(Player.Name)
local PlayerHead = Character:WaitForChild("Head")
local Part = script.Parent
while wait() do
TweenService:Create(Part, TweenInfo.new(0), {CFrame = CFrame.new(Part.CFrame.Position, PlayerHead.CFrame.Position)}):Play()
end
local TweenService = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local Part = script.Parent
while true do task.wait()
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
TweenService:Create(Part, TweenInfo.new(0), {
CFrame = CFrame.lookAt(Part.Position, Vector3.new(
HumanoidRootPart.Position.X,
Part.Position.Y,
HumanoidRootPart.Position.Z
))
}):Play()
end