Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

The GUI will not display the current song. How can I get it to work?

Here is the music player:

while true do
    if not script.MusicOn.Value then
        local Music = game.ServerStorage.Songs:GetChildren()
        local RandomMusic = Music[math.random(1, #Music)]:Clone()
        RandomMusic.Parent = workspace.CurrentSong
		RandomMusic:Play()
        script.MusicOn.Value = true
        print(RandomMusic.Name)
		local musName = Instance.new("StringValue", workspace.CurrentSong)
		musName.Value = (RandomMusic.Name)
		RandomMusic.Ended:connect(function()
			RandomMusic:Destroy()
			wait(.1)
			script.MusicOn.Value = false
			return
		end)
	end
wait(.1)
end

Here is the GUI updater:

while true do
	local Music = game.ServerStorage.Songs:GetChildren() 
	local GUItext = game.Players.LocalPlayer.PlayerGui.MusGui.song_name.Text
	GUItext = workspace.CurrentSong.Value.Value
	wait(1)
end

6 comments

0

Is the GUI Updater a local script or regular script?

0

I have tried both

0

Anything from output?

0

Nope

0

Why have you done GUItext = workspace.CurrentSong.Value.Value? Why are there 2 values?

0

uh FE.. You need to get an event to fire that sends the music name to the GUI..

1 answer

There's 2 errors in your script:

1st error:

local GUItext = game.Players.LocalPlayer.PlayerGui.MusGui.song_name.Text
GUItext = workspace.CurrentSong.Value.Value

You defined GUItext as game.Players.LocalPlayer.PlayerGui.MusGui.song_name.Text and then you defined it again as workspace.CurrentSong.Value.Value so GUItext will always be workspace.CurrentSong.Value.Value.

If you want to have it as two separate objects then you should again use local and name the second object something else (ex. local GUItext2 = game.Workspace.CurrentSong.Value.Value)

2nd error:

GUItext = workspace.CurrentSong.Value.Value

You CAN use workspace.Part, but it is recommended to use game.Workspace.Part.

This discussion is preserved as it was. New answers, comments, and votes are closed.