Fading in & out?

I’m looking for a way to make a Model fade in and fade out with pulses similar to the ‘TARDIS’ shown in the YouTube video?
I’m looking to make it sync the sound perfectly -
Below is a snippet of the code I currently use however it’s very manual & I’m looking for a way to simplify it.

Thank you

repeat task.wait(...) until Takeoff.TimePosition >= 3

		local Num = 0
		for i = 1, 20 do
			if Num >= 1 then
				break
			else
				if i % 2 == 0 or i == 1 then
					Num += 0.2
				else
					Num -= 0.1
				end
				Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = Num})
				task.wait(1)
			end
		end
1 Like

you could use PlaybackLoudness of a sound to reference it

local sound = -- // Sound Here
local TweenInfo = TweenInfo.new(DURATION, Enum.EasingStyle.VALUE, Enum.EasingDirection.DIRECTION)
local Playback = sound.PlaybackLoudness

game:GetService("RunService").RenderStepped:connect(function()
  if Playback > VALUE then
    -- code here
    TweenService:Create(PART, TweenInfo, TARGET_TWEEN):Play()

  elseif Playback < VALUE then
    -- code here
    TweenService:Create(PART, TweenInfo, TARGET_TWEEN):Play()

  elseif Playback == CERTAIN_POINT then
    -- code here
    TweenService:Create(PART, TweenInfo, TARGET_TWEEN):Play()

  end
end)
1 Like

Had issues with this as the initial value setting is done via the server, the actual transparency is set through the client.

I have found that from my audio the take off takes roughly 12 seconds to complete and the landing takes 9 seconds to sync the audio.

So in terms of processing the phasing I’ve come up with:


    local A = 0.08333333333
    local B = 0.11111111111

    Num = 0; Takeoff:Play(...)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = A * 1})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Value = A * 2 - A * 1/2})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = A * 3})--
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Value = (A * 4) - A * 2/2})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = A * 5})--
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Value = A * 6 - A * 3/2})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = A * 7})--
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Value = A * 8 - A * 4/2})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = A * 9})--
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Value = A * 10 - A * 5/2})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = A * 11})--
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Value = A * 12})

    task.wait(1)

    Num =1; Land:Play(...)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 1)})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 2) + B * 1})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 3)})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 4) + B * 2})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 5)})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 6) + B * 3})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 7)})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 8) + B * 4})
    task.wait(1)
    Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * 9)})
    task.wait(1)

Is there anyway to simplify this further?
EDIT: Figured it out.

local A = 0.08333333333
local B = 0.11111111111

Takeoff:Play(...)
for i = 1, 12 do
    if i % 2 == 0 or i == 1 then
        Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = A * i})
    else
        Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = A * i - A * i / 2})
    end
    task.wait(1 - 0.1)
end

task.wait(5)

Land:Play(...)
for i = 1, 9 do
    if i % 2 == 0 then
        Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * i) + B * i/2})
    else
        Core:Tween(NumValue, TweenInfo.new(1, Enum.EasingStyle.Linear), {Value = 1 - (B * i)})
    end
    task.wait(1)
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.