This script is for a opening gui and it plays music. I tried using random math method but it seems to not work at all, or just I'm doing it wrong. What I was trying to make is everytime u join, a new sound plays than the same one previously you joined.
local Sound = script.Sound local GUI = script:WaitForChild("LoadingScreen") local plr = game.Players.LocalPlayer GUI.Parent = plr.PlayerGui script.Parent:RemoveDefaultLoadingScreen() repeat wait(.5) until game:IsLoaded() Sound:Play() Sound.Volume = 1 wait(15) GUI.Frame:TweenPosition(UDim2.new(0,0,-1.5,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad, 1) wait(1) Sound.Volume = .9 wait(.25) Sound.Volume = .8 wait(.25) Sound.Volume = .7 wait(.25) Sound.Volume = .6 wait(.25) Sound.Volume = .5 wait(.25) Sound.Volume = .4 wait(.25) Sound.Volume = .3 wait(.25) Sound.Volume = .2 wait(.25) Sound.Volume = .1 wait(.25) Sound.Volume = .05 wait(.25) Sound.Volume = .025 wait(.25) Sound.Volume = .01 wait(.25) Sound:Stop() GUI:Destroy()
local Sound = script.Sound local GUI = script:WaitForChild("LoadingScreen") local plr = game.Players.LocalPlayer GUI.Parent = plr.PlayerGui script.Parent:RemoveDefaultLoadingScreen() repeat wait(.5) until game:IsLoaded() --change id's here local MusicId = {123456,789012,345678} Sound.SoundId= MusicId[math.random(1,#MusicId)] Sound:Play() Sound.Volume = 1 wait(15) GUI.Frame:TweenPosition(UDim2.new(0,0,-1.5,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad, 1) wait(1) for vv = 1,0,-0.1 do Sound.Volume = vv wait(.25) end Sound.Volume = 0 GUI:Destroy()