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
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
.