So I'm trying to make background music in my game. The audio and functions are working fine by themselves but I'm very confused on why this function is happening before the button HttydRadio is clicked. Another problem I'm having is that when I click a button, it does not start the right function witch makes me think that these problems are related. Here is the script:

local stationA = script.Parent.Songs.Httyd
local stationB = script.Parent.Songs.Rbx
local c = script.Parent.Songs.Custom
local info = script.Parent.Veriables
local chanals = script.Parent.Channels

function httyd()
	info.Station.Value = "H-T-T-Y-D Radio"
	stationA.a:Play()
	info.Song.Value = "Where No One Goes"
	stationA.a.Ended:Wait()
	stationA.b:Play()
	info.Song.Value = "Once There Were Dragons"
	stationA.b.Ended:Wait()
	stationA.c:Play()
	info.Song.Value = "Togeather From Afar"
	stationA.c.Ended:Wait()
	stationA.d:Play()
	info.Song.Value = "Forbidden Friendship"
	stationA.d.Ended:Wait()
	stationA.e:Play()
	info.Song.Value = "Httyd Melody Piano"
	stationA.e.Ended:Wait()
	stationA.f:Play()
	info.Song.Value = "New Tail"
	stationA.f.Ended:Wait()
	local m = Instance.new("Message")
	m.Parent = script.Parent.Parent.Parent
	m.Text = "Radio: The station you were lisining to has ended, to start it agein, click on the chanals button and select H-T-T-Y-D Radio. Or choose a diffrent one."
	wait(10)
	m:Destroy()
end

function rbx()
	info.Station.Value = "RbxRadio"
	stationB.a:Play()
	stationB.a.Ended:Wait()
	stationB.b:Play()
	stationB.b.Ended:Wait()
	stationB.c:Play()
	stationB.c.Ended:Wait()
	stationB.d:Play()
	stationB.d.Ended:Wait()
	stationB.e:Play()
	stationB.e.Ended:Wait()
	stationB.f:Play()
	stationB.f.Ended:Wait()
	stationB.g:Play()
	stationB.g.Ended:Wait()
	stationB.h:Play()
	stationB.h.Ended:Wait()
	stationB.i:Play()
	stationB.i.Ended:Wait()
	stationB.j:Play()
	stationB.j.Ended:Wait()
	local m = Instance.new("Message")
	m.Parent = script.Parent.Parent.Parent
	m.Text = "Radio: The station you were lisining to has ended, to start it agein, click on the chanals button and select RbxRadio. Or choose a diffrent one."
	wait(10)
	m:Destroy()
end

chanals.HttydRadio.MouseButton1Click:Connect(httyd())
chanals.RbxRadio.MouseButton1Click:Connect(rbx())

Can you help me solve this problem? Also, would there be a way to make httyd function stop when the other the function rbx is "activated" and vice versa?

2 comments

0

Try putting the mouse click function inside the actual, function, use it and then statements

0

k ill try it