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:
local PrefMusicStore = game:GetService('DataStoreService'):GetDataStore('PrefferedMusic')
local PrefMusic = PrefMusicStore:GetAsync('User_'..script.Parent.PUserId)
if PrefMusic == nil then
PrefMusicStore:SetAsync('User_'..script.Parent.PUserId, "Creative6")
script.Parent.Parent.Parent.Creative6:Play()
else
script.Parent.Parent.Parent:FindFirstChild(PrefMusic):Play()
end
script.Parent.M1.MouseButton1Click:connect(function()
local Items = script.Parent.Parent.Parent:GetChildren()
for index, value in ipairs(Items) do
if value:IsA('Sound') then
value:Stop()
end
end
wait(.1)
script.Parent.Parent.Parent.Creative6:Play()
PrefMusicStore:SetAsync('User_'..script.Parent.PUserId, "Creative6")
end)
script.Parent.M1.MouseButton1Click:connect(function()
local Items = script.Parent.Parent.Parent:GetChildren()
for index, value in ipairs(Items) do
if value:IsA('Sound') then
value:Stop()
end
end
wait(.1)
script.Parent.Parent.Parent.Damage:Play()
PrefMusicStore:SetAsync('User_'..script.Parent.PUserId, "Damage")
end)

5 comments
PUserId is not a value is it? Don't you have to put .Value?
mighty is right, if 'PUderId' is the actual value object you cannot concatenate it. You have to reference the 'Value' property.
well i got that fixed but it still wont work
Have you tried IsPlaying before?
Nope