Trying to re-cretae a Shrinking Effect

i’ve been recently been trying to re-create a shrinking effect such as(down below),i tryed Tweening it but that dosent work,is their any other way to solve this issue
https://gyazo.com/dbf99f01ab04e19ca7f809626420f541

3 Likes

What was happening when you were tweening the size? Cus I feel as thought tweening the size and adjusting the cframe at the same time should give off a similar effect.

1 Like

ok basically each,prop has its on health,and i want the health to be equal to thesize so if the health value is low than the size is low

-- Assuming Health is an IntValue or NumberValue object
local maxHealth = prop.Health.Value
local originalSize = prop.Size;
local tween;
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(.1)

local con = prop.Health:GetPropertyChangedSignal("Value"):Connect(function()
    local t = tweenService:Create(prop, tweenInfo, {Size = originalSize * (prop.Health.Value/maxHealth)})
    t:Play()
    if tween then
        tween:Cancel()
    end
    tween = t
end)

I’d like to note that this was coded here, so some things might error.
but you essentially want to get the percentage of the health, and then take the props original size - the props original size * said percentage.
However I didn’t take into account offsetting the cframe, you may need to toy with that on your own.

2 Likes

But i see this isnt so efficent,i tryed making the int value to 1 from 2k and it showed like no size different

Depending on how you set it, the GetPropertyChangedSignal may or may not be getting fired. I could make a little test place and upload it if you wish.

1 Like

https://gyazo.com/d5820ea1e34e8d2812974fa83e8f8e37

Are you using a local script or a server script to update the parts size? Because you’re using a client sided view point to update the value in the gif.

2 Likes

server script,idlk why i thought that would work

Also my initial math was wrong, it should work as just the intialSize * the percentage; I updated the code above just incase

1 Like