Why wont this music button script play the music?
I have been trying for a couple hours to do this and it just wont work at all
one error occurred that says: Players.TheGrimDeathZombie.PlayerGui.MainMenu.Options.OptionsFrame.Main:2: attempt to concatenate field 'PUserId' (a userdata value)
the script is here:
01 | local PrefMusicStore = game:GetService( 'DataStoreService' ):GetDataStore( 'PrefferedMusic' ) |
02 | local PrefMusic = PrefMusicStore:GetAsync( 'User_' ..script.Parent.PUserId) |
03 | if PrefMusic = = nil then |
04 | PrefMusicStore:SetAsync( 'User_' ..script.Parent.PUserId, "Creative6" ) |
05 | script.Parent.Parent.Parent.Creative 6 :Play() |
07 | script.Parent.Parent.Parent:FindFirstChild(PrefMusic):Play() |
10 | script.Parent.M 1. MouseButton 1 Click:connect( function () |
11 | local Items = script.Parent.Parent.Parent:GetChildren() |
12 | for index, value in ipairs (Items) do |
13 | if value:IsA( 'Sound' ) then |
18 | script.Parent.Parent.Parent.Creative 6 :Play() |
19 | PrefMusicStore:SetAsync( 'User_' ..script.Parent.PUserId, "Creative6" ) |
22 | script.Parent.M 1. MouseButton 1 Click:connect( function () |
23 | local Items = script.Parent.Parent.Parent:GetChildren() |
24 | for index, value in ipairs (Items) do |
25 | if value:IsA( 'Sound' ) then |
30 | script.Parent.Parent.Parent.Damage:Play() |
31 | PrefMusicStore:SetAsync( 'User_' ..script.Parent.PUserId, "Damage" ) |