Hi, im trying to tween the transparency of a model. This is the script im trying out
local ts = game:GetService("TweenService") local info = TweenInfo.new(4) local function tweenModel(model) local tr = Instance.new("IntValue") tr.Value = 0 local parts = model:GetChildren() tr:GetPropertyChangedSignal("Value"):Connect(function() for i,v in pairs(parts) do if v.ClassName == "Part" or v.ClassName == "UnionOperation" then v.Transparency = tr.Value end end end) local tween = ts:Create(tr, info, {Value = 1}) tween:Play() tween.Completed:connect(function() tr:Destroy() model:Destroy() end) end
But the model just dissapears in under a second. Is there a way to make it disappear slow? I think it doesnt even set the transparency up but just destroy the model in the end.
Didn't test. Should work.
local function tweenModel(model) local TimesToChange = 10 local AmountOfTransparancyToChange = 0.1 local AddOrDecrease = false -- False = Negate Transparency. True = Add Transparency local parts = model:GetChildren() for i,v in pairs(parts) do if v.ClassName == "Part" or v.ClassName == "UnionOperation" then if AddOrDecrease == false then for i = 0, TimesToChange do v.Transparency = v.Transparency - AmountOfTransparancyToChange end else for i = 0, TimesToChange do v.Transparency = v.Transparency + AmountOfTransparancyToChange end end end end end