Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

k = Instance.new("Sound")

script.Parent.Enter.MouseButton1Click:Connect(function()
	if k.SoundId == "Shrek" then
		k.SoundId = "rbxassetid://".."2028376534" -- shrek national anthem
		k.Playing = true
	end
end)
script.Parent.Enter.MouseButton1Click:Connect(function()
	if k.SoundId == "Sans" then
		k.SoundId = "rbxassetid://".."2525122648" -- sans default dance
		k.Playing = true
	end
end)
script.Parent.Enter.MouseButton1Click:Connect(function()
	if k.SoundId == "AW MAN" then
		k.SoundId = "rbxassetid://".."1057637788" -- creepa, AW MAN. SO WE BACK IN THE MINE
		k.Playing = true
	end
end)

and i also tried

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

It continuously fails to load sound ID

Failed to load sound rbxassetid://Sans: Unable to download sound data

3 comments

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?

0

yeah gamer

0

also give us the error so we know what we are working with

1 answer

✓ Accepted answer

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

local Shrek = Instance.new("Sound",script)
Shrek.Name = "Shrek"
Shrek.SoundId = "rbxassetid://2028376534"
local k = Shrek

script.Parent.MouseButton1Click:Connect(function()
	if k.Name == "Shrek" then
		print("Hey")
	end
end)

else

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

New:

for _,k in pairs(script:GetChildren()) do

if k:IsA("Sound")then

script.Parent.MouseButton1Click:Connect(function()
    if k.Name == "Shrek" then
        k.SoundId = "rbxassetid://".."2028376534" -- shrek national anthem
        k.Playing = true
    end
end)
script.Parent.MouseButton1Click:Connect(function()
    if k.Name == "Sans" then
        k.SoundId = "rbxassetid://".."2525122648" -- sans default dance
        k.Playing = true
    end
end)
script.Parent.MouseButton1Click:Connect(function()
    if k.Name == "AW MAN" then
        k.SoundId = "rbxassetid://".."1057637788" -- creepa, AW MAN. SO WE BACK IN THE MINE
        k.Playing = true
    end
end)
end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.