To orient the ClockAura to follow the player’s head’s LookVector, you need to update the orientation of the aura based on the player’s head direction. Instead of using WeldConstraint, which locks the orientation to the root part, you can use a Motor6D or set the CFrame of the aura relative to the head’s LookVector.
This approach keeps the WeldConstraint for the aura, while also setting the correct orientation based on the head’s direction (LookVector).
Let me know if there is any issues
if aura.Value == "Clock" then
local auratoclone = game.ReplicatedStorage:WaitForChild("Auras").ClockAura
local newaura = auratoclone:Clone()
newaura.Parent = rootpart
newaura.Position = rootpart.Position
newaura.Name = "CurrentAura"
-- Create a WeldConstraint to attach the aura to the HumanoidRootPart
local weldconstraint = Instance.new("WeldConstraint")
weldconstraint.Parent = newaura
weldconstraint.Part0 = newaura
weldconstraint.Part1 = rootpart
-- Adjust the orientation to follow the player's head LookVector
local head = rootpart.Parent:WaitForChild("Head")
newaura.CFrame = CFrame.new(newaura.Position) * CFrame.Angles(0, head.CFrame.LookVector.Y, 0)
end
also i added a button for changing auras and if i switch between this aura and a different aura continuously, it stops making it rotated where the head is looking
local function setAuraOrientation(aura, rootpart, head)
if aura then
aura.CFrame = rootpart.CFrame * CFrame.new(0, 3, 0) * CFrame.Angles(0, math.atan2(head.CFrame.LookVector.X, head.CFrame.LookVector.Z), 0)
end
end
local function onAuraSwitched(newAura)
local head = rootpart.Parent:WaitForChild("Head")
local currentAura = rootpart:FindFirstChild("CurrentAura")
if currentAura then
currentAura:Destroy()
end
local auratoclone = game.ReplicatedStorage:WaitForChild("Auras")[newAura]
local newaura = auratoclone:Clone()
newaura.Parent = rootpart
newaura.Name = "CurrentAura"
local weldconstraint = Instance.new("WeldConstraint")
weldconstraint.Parent = newaura
weldconstraint.Part0 = newaura
weldconstraint.Part1 = rootpart
setAuraOrientation(newaura, rootpart, head)
end
game:GetService("RunService").RenderStepped:Connect(function()
local currentAura = rootpart:FindFirstChild("CurrentAura")
if currentAura then
local head = rootpart.Parent:WaitForChild("Head")
setAuraOrientation(currentAura, rootpart, head)
end
end)
I’ve made it a bit easier to read, but I can’t make it smaller than it is.
local function setAuraOrientation(aura, rootpart, head)
if aura then
aura.CFrame = rootpart.CFrame * CFrame.new(0, 3, 0) * CFrame.Angles(0, math.atan2(head.CFrame.LookVector.X, head.CFrame.LookVector.Z), 0)
end
end
local function switchAura(newAura, rootpart)
local head = rootpart.Parent:WaitForChild("Head")
local currentAura = rootpart:FindFirstChild("CurrentAura")
if currentAura then
currentAura:Destroy()
end
local auratoclone = game.ReplicatedStorage:WaitForChild("Auras")[newAura]
local newaura = auratoclone:Clone()
newaura.Parent = rootpart
newaura.Name = "CurrentAura"
local weldconstraint = Instance.new("WeldConstraint")
weldconstraint.Parent = newaura
weldconstraint.Part0 = newaura
weldconstraint.Part1 = rootpart
setAuraOrientation(newaura, rootpart, head)
end
game:GetService("RunService").RenderStepped:Connect(function()
local currentAura = rootpart:FindFirstChild("CurrentAura")
if currentAura then
local head = rootpart.Parent:WaitForChild("Head")
setAuraOrientation(currentAura, rootpart, head)
end
end)