Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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
0
Is the GUI Updater a local script or regular script? AvionicScript 65 — 6y
0
I have tried both SignorOmbra 17 — 6y
0
Anything from output? AswormeDorijan111 531 — 6y
0
Nope SignorOmbra 17 — 6y
View all comments (2 more)
0
Why have you done GUItext = workspace.CurrentSong.Value.Value? Why are there 2 values? RaggaMuffinzz 0 — 6y
0
uh FE.. You need to get an event to fire that sends the music name to the GUI.. Twenty1chickens 4 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question