I am making a game with my friends and since most people are busy, I am having to do almost everything coding related even though I am not very good at it.
I am trying to make some kind of GUI Health bar, and I wrote a script with the purpose of making a frame smaller on the X-axis when the health lowers. However, the script doesn't work and I don't know why.
local Frame = script.Parent.Frame.Frame.Size.X local playerHP = game.Players.LocalPlayer.Character.Humanoid.Health while playerHP > 0 do Frame = playerHP*3.45 -- Multiplier is 3.45 because that's the size of the frame end
I also need help with making the GUI visible to each player individually, so that when someone else takes damage, the other players' health bar doesn't change.
Thanks in advance.
So you will need a few things: Frame, LocalScript, and ScreenGui. Insert the Frame and the LocalScript into the ScreenGui. Position the Frame however you want. Then make this in the LocalScript (EDITED BECAUSE OF VERTICAL):
local frame = script.Parent:WaitForChild("Frame") local char = script.Parent.Parent.Parent.Character char:WaitForChild("Humanoid"):GetPropertyChangedSignal("Health"):Connect(function() frame:TweenSize(UDim2.new(frame.Size.X.Scale,frame.Size.X.Offset,frame.Size.Y.Scale,char.Humanoid.Health)) end)