Remote event won't change text in UI

hmmm…it didn’t work
I used: repeat wait()until
game.Players.plr.PlayerGui.radio.radiopannel.SongName ~= nil
and the console said that plr isnt a part of “Players”
but in the script it was clearly stated that local plr = hum.Parent
I’m confused now :thinking:

1 Like

In a localscript, use game.Players.LocalPlayer.PlayerGui.radio.radiopannel.SongName

2 Likes

WAIT GOOD NEWS
I got it fixed, appearently, because the radio gui is inside the car seat, I don’t have to locate them inside the player gui (although it will clone to there). I just have to set path to the Song name in radio gui inside the car seat, and it somehow worked!

But still, thanks for your help! really appreciated it! :grin:

1 Like

bad news after a while I realised that it still wasn’t able to solve the problem, so I tried another method:
Put the sound in the workspace, and use a server script to play it, then for the song info I used remote event but it seems like it didnt really take effect

This is the script in server scripts

local music = workspace.Music
local sound1 = "10199337266" -- Sound IDs
local sound2 = "5409360995"
local change = game.ReplicatedStorage:WaitForChild("Change")


while true do -- Loop
	wait()
	music.SoundId = "rbxassetid://"..sound1 -- making the sound ID the first song
	local Songname1 = "Madeon - Love You Back"
	music:Play(function()
		change:FireAllClients(Songname1)
		print("sent!")
	end)
	music.Ended:Wait() -- when the song ends
	music.SoundId = "rbxassetid://"..sound2 -- changes the sound ID to the second song
	local Songname2 = "Dion Timmer - Shiawase"
	music:Play(function()
		change:FireAllClients(Songname2)
		print("sent")
	end)
	music.Ended: wait()
end

This is script under the song name textlabel

local change = game.ReplicatedStorage:WaitForChild("Change")
change.OnClientEvent:Connect(function(Songname1)
	script.Parent.Text = Songname1
end)
change.OnClientEvent:Connect(function(Songname2)
	script.Parent.Text = Songname2
end)

Right now the 1st song can be played but then the 2nd song won’t play using this script

I checked console during tests but it seems like even though I wrote to let it “print sent!” it didnt actually print anything, so could you help me with the problem please?

1 Like

The Gui shows the name of the song that is playing, (the first one) right?
Or does the Gui show both but only the first one plays?

1 Like

It will only show one. I’ve did another test and confired that remote event did not got fired by the server script for some reason

1 Like

Aha. I found the issue. (I think)
On the second music.Ended:Wait(), (Or should I say music.Ended :Wait()) there is a space before the colon, so it’s instantly going back to the first song.

1 Like

Changed it, still didn’t work, I tried even changing the defined “songname1” in the script, and it should suppose to change the UI to whatever is defined but it didn’t, that means the remote event didn’t fire at all

1 Like

If you add a print after the first music.Ended:Wait(), does it print anything?

1 Like

Maybe try replacing it with a wait() with the length of the song

1 Like

Ok first the good news is that well the 2nd song actually played, it didnt play at the start because it wasn’t loaded yet

1 Like

But the thing is that the remote event didn’t fire for some reason, I heard it changed to the 2nd song but the names on the ui didn’t change

1 Like

Ok so I tried this and it does print out something

1 Like

What if you take the RemoteEvent and the print out of the function?

I’m a bit unsure what do you mean by that, can you please write out a part of the code so I can see what you mean?

music:Play
change:FireAllClients(Songname1)
print("sent!")
1 Like

Nice! It worked! Thanks so much!!!