.Changed not updating with an ImageButton?

Greetings, I made a random music script, however I’m trying to connect it to a setting, but that doesn’t seem to be working, as I have an image that updates to a check mark in a box (on), and just a box (off), however when i do Image.Changed:Connect(function() it doesn’t seem to work. Any help with this would be appreciated.

local Music = game:GetService("Workspace").Music

game:GetService("Players").PlayerAdded:Connect(function(Player)
	Player.PlayerGui:WaitForChild("Settings").Menu.MusicButton.Changed:Connect(function()
		print("Changed") --Doesn't print, .Changed doesn't work
		if Player.PlayerGui.Settings.Menu.MusicButton.Image == "http://www.roblox.com/asset/?id=4458804262" then
			Music.Playing = true
			
			while Player.PlayerGui.Settings.Menu.MusicButton.Image == "http://www.roblox.com/asset/?id=4458804262" do
				local RandomSong = MusicList[math.random(1,#MusicList)]

				Music.SoundId = "rbxassetid://"..RandomSong
				Music.Playing = true

				task.wait(Music.TimeLength)

			end
			
		else
			Music.Playing = false
			
		end
	end)
end)

You most likely change the Image on the client, so the changed event should also be on the client.

Yeah, putting it in a local script and then sending it through a RemoteEvent would probably work better, I’ll give it a try and see if it works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.