I’ll make it simple.
When player joins the GUI appear and say “Now playing: [SONGNAME]” then disappear after a while
The GUI will appear again when the song is over with a wait(Song.TimeLenght+10)
The issue: If a player joins when the song is already started the GUI will appear after the difference time between song lenght and join time (If the player joined when the music was at 1 minute the GUI will appear when the next song is at 1 minute and not at the start of it)
Same if the player resets character or dies in any way.
Is there a way to make the GUI only appear when the song starts?
Even if the player joins after 2 minutes the GUI will appear one time then wait till the next start
Script:
SongModule = require(workspace.Songs.ModuleScript)
TweenService = game:GetService("TweenService")
local frame = script.Parent
wait(10)
while true do
r = workspace.SongScript.Value.Value
script.Parent.Text = ("Now Playing: ".. SongModule[r].Name)
frame.AnchorPoint = Vector2.new(0.5, 0.5)
frame.Position = UDim2.new(3, 0, 0.5, 0)
-- Set up tweens
local tweenInfo1 = TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween1 = TweenService:Create(frame, tweenInfo1, {Position=UDim2.new(-3, 0, 0.5, 0)})
tween1.Completed:Connect(function()
repeat
script.Parent.Parent.BackgroundTransparency = script.Parent.Parent.BackgroundTransparency+0.03
wait()
until script.Parent.Parent.BackgroundTransparency >= 1
end)
tween1:Play()
wait(workspace.Songs.Playing.TimeLength+10)
repeat
script.Parent.Parent.BackgroundTransparency = script.Parent.Parent.BackgroundTransparency-0.05
wait()
until script.Parent.Parent.BackgroundTransparency <= 0
end