I have this game I’m developing, It’s one of those “Kick/Punch Wall Simulator” type games. I have an issue with the Health Bar (SurfaceGui) on the Wall. I don’t know how to fix it.
--why is the health reduction just plain there,
--is it supposed to be a touched event or something?
local strength = Player.leaderstats:WaitForChild("Strength")
local ts = game:GetService("TweenService")
local info = TweenInfo.new(1, Enum.EasingStyle.Linear)
local MAX_HEALTH = 120--change to actual maxhealth, or add an attribute maxhealth
Wall:GetAttributeChangedSignal("Health"):Connect(function()
--assuming front is the green thing
local tween = ts:Create(Front, info, {Size = Udim2.fromScale(Wall:GetAttribute("Health")/MAX_HEALTH, 1)
tween:Play()
end)
and now the bar resizes when health goes up or down.
TweenPosition is deprecated, Why do I see so many people using deprecated things.
Use the better versions, refer to the docs if you suspect something is deprecated.