I have a local script for my game that will play a random sound after the previous is finished. For some reason, this plays 2 at the same time. Not any more, not any less. I’ve looked at other posts, but they didn’t help. This script worked perfectly fine before i put it in StarterGui, but i still want to keep the Now Playing text.
local TS = game:GetService("TweenService")
local tweenIN = TS:Create(script.Parent.PlayingLabel, TweenInfo.new(0.8, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut, 0, false),
{ Position = UDim2.new(0.027, 0, 0.469, 0) }
)
local tweenOUT = TS:Create(script.Parent.PlayingLabel, TweenInfo.new(0.8, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut, 0, false),
{ Position = UDim2.new(-0.2, 0, 0.469, 0) }
)
while wait(1) do
local Sounds = game.SoundService.Songs:GetChildren()
local RandomIndex = math.random(1, #Sounds)
local RandomSound = Sounds[RandomIndex]
RandomSound:Play()
script.Parent.PlayingLabel.Text = [[Now Playing "]]..RandomSound.Name..[["]]
tweenIN:Play()
task.spawn(function()
tweenIN.Completed:Wait()
task.wait(3)
tweenOUT:Play()
end)
RandomSound.Ended:Wait()
end