I needed to make a part that grows in size and becomes transparent at the same time. This works most of the time, but at seemingly random times it doesn’t.
Here’s the code:
local ts = game:GetService("TweenService")
local smallsize = Vector3.new(30.466, 35.83, 34.012)
local bigsize = Vector3.new(49.166, 58.116, 55.083)
local radiate = false
workspace.CoreData.Radiate.Changed:Connect(function(val)
radiate = val
if val == true then
script.Parent.Transparency = 0
else
script.Parent.Transparency = 1
script.Parent.Size = smallsize
end
end)
while wait() do
if radiate == true then
script.Parent.Transparency = 0
ts:Create(script.Parent,TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Size = bigsize, Transparency = 1}):Play()
wait(2)
script.Parent.Size = smallsize
end
end
And here’s a video showing what happens. The issues begin around the 30-second mark.
Does anybody see any issues with the code that might cause this strange behavior?