I made a sound system that plays songs selectable from a list. It worked fine in Studio but does not work in-game. The sounds do not copy to my Parts that are speakers, most of the time. But when they do the song does not play. Is there any way to fix this? I'm thinking Remote Events as a fix but I'd like to know other options. All help is appreciated.
P.S I know there are unused variables, had to shorten the script.
Songs = game:GetService("ReplicatedFirst").Storage
SoundTable = {Songs["0To100"], Songs.Antidote, Songs.BecauseI, Songs.BlackBeatles, Songs.Centuries, Songs.ColdWater
, Songs.Colt45, Songs.DatBeat, Songs.DontMind, Songs.Froze, Songs.Heathens, Songs.Meek, Songs.MyHouse
, Songs.OneDance, Songs.Panda, Songs.Panda, Songs.PurpleLambo, Songs.RICO, Songs.Ritual, Songs.SevenNationArmy
, Songs.StartedFromTheBottom, Songs.StressedOut, Songs.TakeMeToChurch, Songs.TheNights, Songs.TheQuan, Songs.Ultimate
, Songs.UpLikeTrump, Songs.UsedToThis, Songs.WhereYaAt, Songs.WorstBehaviour
}
ScreenOne = script.Parent.ScreenOne
ScreenTwo = script.Parent.ScreenTwo
Songs = game:GetService("ReplicatedFirst").Storage
OnNextList = false
OnFirstList = true
OneSwitched = false
TwoSwitched = false
SoundAdded = false
Display = script.Parent.Playing.SurfaceGui.TextLabel
WaitTime = 0
--ScreenTwo Variables
SOnNextList = false
SOnFirstList = true
ScreenOne.SurfaceGui.Change.MouseButton1Click:connect(function()
print("Changing List")
if OnFirstList == true and OnNextList == false then
OnFirstList = false
OnNextList = true
OneSwitched = true
ScreenOne.SurfaceGui.Change.Text = ("Back")
ScreenOne.SurfaceGui.LabelOne.Text = ("My House - Flo Rida")
ScreenOne.SurfaceGui.LabelTwo.Text = ("Drake - One Dance")
ScreenOne.SurfaceGui.LabelThree.Text = ("Hit The Quan - iHeart Memphis")
ScreenOne.SurfaceGui.LabelFour.Text = ("Future - Used To This ft. Drake")
ScreenOne.SurfaceGui.LabelFive.Text = ("Drake - 0 To 100")
ScreenOne.SurfaceGui.LabelSix.Text = ("Up Like Trump - Rae Sremmurd")
ScreenOne.SurfaceGui.LabelSeven.Text = ("Future - Where Ya At ft. Drake")
print("Finished")
elseif OnFirstList == false and OnNextList == true then
OnFirstList = true
OnNextList = false
OneSwitched = false
ScreenOne.SurfaceGui.Change.Text = ("Next")
ScreenOne.SurfaceGui.LabelOne.Text = ("Rae Sremmurd - Black Beatles ft. Gucci Mane")
ScreenOne.SurfaceGui.LabelTwo.Text = ("Major Lazer ft. Justin Bieber & MØ - Cold Water")
ScreenOne.SurfaceGui.LabelThree.Text = ("Marshmello - Ritual")
ScreenOne.SurfaceGui.LabelFour.Text = ("Twenty One Pilots - Heathens")
ScreenOne.SurfaceGui.LabelFive.Text = ("Twenty One Pilots - Stressed Out")
ScreenOne.SurfaceGui.LabelSix.Text = ("Desiigner- Panda")
ScreenOne.SurfaceGui.LabelSeven.Text = ("JuJu On Dat Beat ft. Zay Hilfigerrr - Zayion McCall")
print("Finished")
end
end)
ScreenOne.SurfaceGui.ButtonOne.MouseButton1Click:connect(function()
if OneSwitched == false and SoundAdded == false then
SoundAdded = true
local S = SoundTable[4]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Now Playing: Rae Sremmurd - Black Beatles ft. Gucci Mane")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
elseif OneSwitched == true and SoundAdded == false then
local S = SoundTable[13]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Now Playing: My House - Flo Rida")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
end
end)
ScreenOne.SurfaceGui.ButtonTwo.MouseButton1Click:connect(function()
if OneSwitched == false and SoundAdded == false then
SoundAdded = true
local S = SoundTable[6]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Major Lazer ft. Justin Bieber & MØ - Cold Water")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
elseif OneSwitched == true and SoundAdded == false then
local S = SoundTable[14]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Drake - One Dance")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
end
end)
ScreenOne.SurfaceGui.ButtonThree.MouseButton1Click:connect(function()
if OneSwitched == false and SoundAdded == false then
SoundAdded = true
local S = SoundTable[19]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Marshmello - Ritual")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
elseif OneSwitched == true and SoundAdded == false then
local S = SoundTable[25]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Hit The Quan - iHeart Memphis")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
end
end)
ScreenOne.SurfaceGui.ButtonFour.MouseButton1Click:connect(function()
if OneSwitched == false and SoundAdded == false then
SoundAdded = true
local S = SoundTable[11]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Twenty One Pilots - Heathens")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
elseif OneSwitched == true and SoundAdded == false then
local S = SoundTable[27]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Future - Used To This ft. Drake")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
end
end)
ScreenOne.SurfaceGui.ButtonFive.MouseButton1Click:connect(function()
if OneSwitched == false and SoundAdded == false then
SoundAdded = true
local S = SoundTable[22]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Twenty One Pilots - Stressed Out")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
elseif OneSwitched == true and SoundAdded == false then
local S = SoundTable[1]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Drake - 0 To 100")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
end
end)
ScreenOne.SurfaceGui.ButtonSix.MouseButton1Click:connect(function()
if OneSwitched == false and SoundAdded == false then
SoundAdded = true
local S = SoundTable[15]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Desiigner- Panda")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
elseif OneSwitched == true and SoundAdded == false then
local S = SoundTable[27]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Up Like Trump - Rae Sremmurd")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
end
end)
ScreenOne.SurfaceGui.ButtonSeven.MouseButton1Click:connect(function()
if OneSwitched == false and SoundAdded == false then
SoundAdded = true
local S = SoundTable[8]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("JuJu On Dat Beat ft. Zay Hilfigerrr - Zayion McCall")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
elseif OneSwitched == true and SoundAdded == false then
local S = SoundTable[29]
local Sound = S:Clone()
workspace.Playing.SurfaceGui.TextLabel.Text = ("Future - Where Ya At ft. Drake")
Sound.Parent = script.Parent.Speaker
WaitTime = Sound.TimeLength
Sound:Play()
wait(WaitTime)
Sound:Destroy()
SoundAdded = false
print("Ready to play")
end
end)
end)
