Hello,
I have been working on an intro gui for my game.
this is it so far:
(it didnt upload it was stuck at 50%) sorry.
So far its good. I just need to replace my game name with my logo and a few other improvements.
I have been wondering on how I can fade out the music at the end, instead of it stopping immediately.
I am not the best scripter, but I do try my best. However, I just don’t know how to do this one.
You can use a callback function in addition to @Halalaluyafail3’s code.
local Tween = TweenService:Create(sound,TweenInfo.new(1),{Volume = 0})
Tween:Play()
Tween.Completed:Connect(function(State)
if State == Enum.PlaybackState.Completed then
sound:Destroy()
Tween:Destroy()
end
end)
wait(24)
local text = "SWORD REALMS"
local player = script.Parent.Parent
local gui = script.Parent
local sound = Instance.new("Sound",gui)
sound.SoundId = ""
sound.Pitch = 1
sound.Volume = 0.8
local frame = gui.Frame
local text1 = frame.TextLab
wait(1)
sound:play()
for i = 1,string.len(text),1 do
text1.Text = string.sub(text,1,i)
wait(0.1)
end
coroutine.resume(coroutine.create(function()
for i = 0, 0.8, 0.05 do
sound.Volume = i
wait(0.5)
end
end))
for i = 1,50,1 do
text1.TextTransparency = text1.TextTransparency + 0.02
wait(0.01)
end
gui:Destroy()
The code that I would use would be:
-- Variables --
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Title = "SWORD REALMS"
local GUI = script.Parent
local Sound = Instance.new("Sound")
Sound.Parent = Workspace
Sound.SoundId = ""
Sound.PlaybackSpeed = 1
Sound.Volume = 0.8
local Frame = GUI:WaitForChild("Frame")
local TextLabel = GUI:WaitForChild("TextLab")
-- Scripting --
wait(25)
Sound:Play()
for i = 1, Title:len(), 1 do
TextLabel.Text = Title:sub(1, i)
wait(0.1)
end
for i = 0, Sound.Volume, -0.05 do
Sound.Volume = i
wait(0.5)
end
for i = 1, 0, 0.02 do
TextLabel.Transparency = i
wait(0.01)
end
Sound:Destroy()
GUI:Destroy()