k = Instance.new("Sound")
01 | script.Parent.Enter.MouseButton 1 Click:Connect( function () |
02 | if k.SoundId = = "Shrek" then |
03 | k.SoundId = "rbxassetid://" .. "2028376534" -- shrek national anthem |
04 | k.Playing = true |
05 | end |
06 | end ) |
07 | script.Parent.Enter.MouseButton 1 Click:Connect( function () |
08 | if k.SoundId = = "Sans" then |
09 | k.SoundId = "rbxassetid://" .. "2525122648" -- sans default dance |
10 | k.Playing = true |
11 | end |
12 | end ) |
13 | script.Parent.Enter.MouseButton 1 Click: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 |
18 | end ) |
and i also tried
1 | . |
2 | if k.SoundId = = "rbxassetid://" .. "Shrek" then |
It continuously fails to load sound ID
1 | Failed to load sound rbxassetid://Sans: Unable to download sound data |
If you use the "rbxassetid: //" then it can not be the soundid "Shrek", because it uses numbers and not stringers, ie names. Use:
01 | local Shrek = Instance.new( "Sound" ,script) |
02 | Shrek.Name = "Shrek" |
03 | Shrek.SoundId = "rbxassetid://2028376534" |
04 | local k = Shrek |
05 |
06 | script.Parent.MouseButton 1 Click:Connect( function () |
07 | if k.Name = = "Shrek" then |
08 | print ( "Hey" ) |
09 | end |
10 | end ) |
else
1 | script.Parent.Enter.MouseButton 1 Click:Connect( function () |
2 | if k.SoundId = = "rbxassetid://" .. "Shrek" then |
3 | k.SoundId = "rbxassetid://" .. "Shrek" |
4 | end |
5 | end ) |
New:
01 | for _,k in pairs (script:GetChildren()) do |
02 |
03 | if k:IsA( "Sound" ) then |
04 |
05 | script.Parent.MouseButton 1 Click:Connect( function () |
06 | if k.Name = = "Shrek" then |
07 | k.SoundId = "rbxassetid://" .. "2028376534" -- shrek national anthem |
08 | k.Playing = true |
09 | end |
10 | end ) |
11 | script.Parent.MouseButton 1 Click:Connect( function () |
12 | if k.Name = = "Sans" then |
13 | k.SoundId = "rbxassetid://" .. "2525122648" -- sans default dance |
14 | k.Playing = true |
15 | end |