So in my script:
local tweenService = game:GetService("TweenService")
local intro = workspace["Chocoblox Factory Tycoon Intro"]
local music = workspace["Chocoblox Factory Tycoon Spring"]
script.Parent.Parent.Parent.Enabled = true
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,false)
local length = intro.TimeLength - 1.5
local musicFadeTimeMinus = 2.25
local musicFadeTimeWait = length - musicFadeTimeMinus
local tweenInfo = TweenInfo.new(length,Enum.EasingStyle.Linear)
local function fadeOut()
for i = 0, 1, 0.01 do
script.Parent.Parent.BackgroundTransparency = i
script.Parent.ImageTransparency = i
wait(0.001)
end
wait(0.5)
script.Parent.Parent.Parent:Destroy()
end
local function fadeMusic()
print("START - FADING MUSIC")
for i = 0.5, 0, 0.01 do
intro.Volume = i
print(i)
wait(0.05)
end
print("END - FADING MUSIC")
end
wait(1)
local plr = game.Players.LocalPlayer
if plr then
intro:Play()
end
local info = {}
info.Offset = Vector2.new(0,-1)
local tween = tweenService:Create(script.Parent.UIGradient,tweenInfo,info)
tween:Play()
wait(musicFadeTimeWait)
fadeMusic()
wait(musicFadeTimeMinus + 1)
coroutine.wrap(fadeOut)()
wait(0.5)
music:Play()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,true)
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
The tween plays and near the end the music volume goes down.
For some reason, the music doesn’t volume doesn’t fade.
I get the print statement:
print("FADING MUSIC")
but I don’t get the print statement:
print(i).
Why? Are there any typos that I missed?
Also the start and end print statements print at the same time (I think)