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

Why is my custom music id always giving me a error when i use a custom ID?

Asked by
iuclds 720 Moderation Voter
5 years ago
Edited 5 years ago

k = Instance.new("Sound")

01script.Parent.Enter.MouseButton1Click:Connect(function()
02    if k.SoundId == "Shrek" then
03        k.SoundId = "rbxassetid://".."2028376534" -- shrek national anthem
04        k.Playing = true
05    end
06end)
07script.Parent.Enter.MouseButton1Click:Connect(function()
08    if k.SoundId == "Sans" then
09        k.SoundId = "rbxassetid://".."2525122648" -- sans default dance
10        k.Playing = true
11    end
12end)
13script.Parent.Enter.MouseButton1Click:Connect(function()
14    if k.SoundId == "AW MAN" then
15        k.SoundId = "rbxassetid://".."1057637788" -- creepa, AW MAN. SO WE BACK IN THE MINE
16        k.Playing = true
17    end
18end)

and i also tried

1.
2if k.SoundId == "rbxassetid://".."Shrek" then

It continuously fails to load sound ID

1Failed to load sound rbxassetid://Sans: Unable to download sound data
0
are you trying to make it so people can type out the sound instead of writing the numbers and then the sound will play? Gameplayer365247v2 1055 — 5y
0
yeah gamer iuclds 720 — 5y
0
also give us the error so we know what we are working with Gameplayer365247v2 1055 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

If you use the "rbxassetid: //" then it can not be the soundid "Shrek", because it uses numbers and not stringers, ie names. Use:

01local Shrek = Instance.new("Sound",script)
02Shrek.Name = "Shrek"
03Shrek.SoundId = "rbxassetid://2028376534"
04local k = Shrek
05 
06script.Parent.MouseButton1Click:Connect(function()
07    if k.Name == "Shrek" then
08        print("Hey")
09    end
10end)

else

1script.Parent.Enter.MouseButton1Click:Connect(function()
2    if k.SoundId ==  "rbxassetid://".."Shrek" then
3        k.SoundId = "rbxassetid://".."Shrek"
4    end
5end)

New:

01for _,k in pairs(script:GetChildren()) do
02 
03if k:IsA("Sound")then
04 
05script.Parent.MouseButton1Click:Connect(function()
06    if k.Name == "Shrek" then
07        k.SoundId = "rbxassetid://".."2028376534" -- shrek national anthem
08        k.Playing = true
09    end
10end)
11script.Parent.MouseButton1Click:Connect(function()
12    if k.Name == "Sans" then
13        k.SoundId = "rbxassetid://".."2525122648" -- sans default dance
14        k.Playing = true
15    end
View all 24 lines...
Ad

Answer this question