Hey everyone!
I just made a simple script of a durability bar (Like a life bar) of an object.
I’m trying to reduce the size of the object by tweening the part but it doesn’t work.
Does anyone know how to fix that?
This is my script:
local TweenService = game:GetService("TweenService")
local maxDur = script.Parent.Parent.Parent:WaitForChild("MaxDurability").Value
local part = script.Parent.Parent.Parent
local dur = script.Parent.Parent.Parent:WaitForChild("Durability").Value/maxDur
local tweeningInformation = TweenInfo.new(
0.15,
Enum.EasingStyle.Back,
Enum.EasingDirection.Out,
0,
false,
0
)
while wait(.2) do
local partProperties = {
Size = Vector3.new(5*dur, 2.6*dur, 5*dur)
}
local Tween = TweenService:Create(part,tweeningInformation, partProperties)
script.Parent:TweenSize((UDim2.new(dur,0,1,0)),Enum.EasingDirection.Out,Enum.EasingStyle.Back,0.15)
Tween:Play()
print(part.Size)
end
The durability bar works perfectly !