I am trying to make the math of a part following the player And the life of the player i want the Part green to diminish when the life of a player is diminshing but i also wanted to make it follow where te camera is looking at this is what i tried so far:
game.workspace:WaitForChild("Player")
while true do
wait(0.01)
local AngleX, AngleY, AngleZ = workspace.CurrentCamera.CFrame:toEulerAnglesXYZ()
local PosX = game.workspace.Player.Head.CFrame.x
local PosZ = game.workspace.Player.Head.CFrame.z
local PosY = game.workspace.Player.Head.CFrame.y
local Rotation = CFrame.Angles(AngleX, AngleY, AngleZ)
local SizeX = game.workspace.PlayerLife.LifeBar.Size.X
game.workspace.PlayerLife.LifeBar.CFrame = Rotation + Vector3.new(PosX, PosY + 2, PosZ)
game.workspace.PlayerLife.LIfeRed.CFrame = Rotation + Vector3.new(PosX, PosY + 2, PosZ)
end
i tried things after but doesnt worked the green one wasnt following the red one or it wasnt working at all And its a bit laggy i don't know how to make it move smoothly

1 comment
Thx for the awnser its what i wanted but when the green portion rezize it resize in the middle what i need is i need it to resize on the left side