Failed to load sound rbxassetid:// ID: Unable to download sound data
i have done everything so why wont it work
it would be a real pain to recode it
Failed to load sound rbxassetid:// ID: Unable to download sound data
it would be a real pain to recode it
hey! do you mind copying and pasting the code in its format so i could see? image appears to be out of context.
i think instead of using ‘https://www.roblox.com/asset/?id’ you will have to use ‘rbxassetid://’
Gui = script.Parent
Player = game.Players.LocalPlayer
PlayingEnabled = false
ScriptReady = false
----------------------------------
----------------------------------
----------------------------------
---------PIANO CONNECTION---------
----------------------------------
----------------------------------
----------------------------------
----------------------------------
------------VARIABLES-------------
----------------------------------
PianoId = nil
Connector = game.Workspace:FindFirstChild("GlobalPianoConnector")
----------------------------------
------------FUNCTIONS-------------
----------------------------------
function Receive(action, a, b, c, d)
if not ScriptReady then return end
if action == "activate" then
if not PlayingEnabled then
Activate(a)
end
elseif action == "deactivate" then
if PlayingEnabled then
Deactivate()
end
elseif action == "play" then
if Player ~= c then
PlayNoteServer(a, b, d)
end
end
end
function Activate(cframe)
PlayingEnabled = true
MakePreventJumpConnections()
MakeKeyboardConnections()
MakeGuiConnections()
SetCamera(cframe)
ShowPiano()
end
function Deactivate()
PlayingEnabled = false
BreakPreventJumpConnections()
BreakKeyboardConnections()
BreakGuiConnections()
HidePiano()
HideSheets()
ReturnCamera()
Jump(true)
end
function PlayNoteClient(note)
PlayNoteSound(note)
HighlightPianoKey(note)
Connector:FireServer("play", note)
end
function PlayNoteServer(note, point, range)
PlayNoteSound(note, point, range)
end
function Abort()
Connector:FireServer("abort")
end
----------------------------------
-----------CONNECTIONS------------
----------------------------------
Connector.OnClientEvent:connect(Receive)
----------------------------------
----------------------------------
----------------------------------
----------KEYBOARD INPUT----------
----------------------------------
----------------------------------
----------------------------------
----------------------------------
------------VARIABLES-------------
----------------------------------
InputService = game:GetService("UserInputService")
Mouse = Player:GetMouse()
TextBoxFocused = false
----------------------------------
------------FUNCTIONS-------------
----------------------------------
function LetterToNote(key, shift)
local letterNoteMap = "1!2@34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm"
local capitalNumberMap = ")!@#$%^&*("
local letter = string.char(key)
if shift then
if tonumber(letter) then
-- is a number
letter = string.sub(capitalNumberMap, tonumber(letter) + 1, tonumber(letter) + 1)
else
letter = string.upper(letter)
end
end
local note = string.find(letterNoteMap, letter, 1, true)
if note then
return note
end
end
function KeyDown(Object)
if TextBoxFocused then return end
local key = Object.KeyCode.Value
local shift = InputService:IsKeyDown(304)
if (key >= 97 and key <= 122) or (key >= 48 and key <= 57) then
-- a letter was pressed
local note = LetterToNote(key, shift)
if note then PlayNoteClient(note) end
elseif key == 8 then
-- backspace was pressed
Deactivate()
elseif key == 32 then
-- space was pressed
ToggleSheets()
end
end
function Input(Object)
local type = Object.UserInputType.Name
local state = Object.UserInputState.Name -- in case I ever add input types
if type == "Keyboard" then
if state == "Begin" then
KeyDown(Object)
end
end
end
function TextFocus()
TextBoxFocused = true
end
function TextUnfocus()
TextBoxFocused = false
end
----------------------------------
-----------CONNECTIONS------------
----------------------------------
KeyboardConnection = nil
JumpConnection = nil
FocusConnection = InputService.TextBoxFocused:connect(TextFocus) --always needs to be connected
UnfocusConnection = InputService.TextBoxFocusReleased:connect(TextUnfocus)
function MakeKeyboardConnections()
KeyboardConnection = InputService.InputBegan:connect(Input)
end
function BreakKeyboardConnections()
KeyboardConnection:disconnect()
end
----------------------------------
----------------------------------
----------------------------------
----------GUI FUNCTIONS-----------
----------------------------------
----------------------------------
----------------------------------
----------------------------------
------------VARIABLES-------------
----------------------------------
PianoGui = Gui.PianoGui
SheetsGui = Gui.SheetsGui
SheetsVisible = false
----------------------------------
------------FUNCTIONS-------------
----------------------------------
function ShowPiano()
PianoGui:TweenPosition(
UDim2.new(0.5, -380, 1, -220),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
.5,
true
)
end
function HidePiano()
PianoGui:TweenPosition(
UDim2.new(0.5, -380, 1, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
.5,
true
)
end
function ShowSheets()
SheetsGui:TweenPosition(
UDim2.new(0.5, -200, 1, -520),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
.5,
true
)
end
function HideSheets()
SheetsGui:TweenPosition(
UDim2.new(0.5, -200, 1, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
.5,
true
)
end
function ToggleSheets()
SheetsVisible = not SheetsVisible
if SheetsVisible then
ShowSheets()
else
HideSheets()
end
end
function IsBlack(note)
if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then
return true
end
end
function HighlightPianoKey(note)
local keyGui = PianoGui.Keys[note]
if IsBlack(note) then
keyGui.BackgroundColor3 = Color3.new(50/255, 50/255, 50/255)
else
keyGui.BackgroundColor3 = Color3.new(200/255, 200/255, 200/255)
end
delay(.5, function() RestorePianoKey(note) end)
end
function RestorePianoKey(note)
local keyGui = PianoGui.Keys[note]
if IsBlack(note) then
keyGui.BackgroundColor3 = Color3.new(0, 0, 0)
else
keyGui.BackgroundColor3 = Color3.new(1, 1, 1)
end
end
function PianoKeyPressed(Object, note)
local type = Object.UserInputType.Name
if type == "MouseButton1" or type == "Touch" then
PlayNoteClient(note)
end
end
function ExitButtonPressed(Object)
local type = Object.UserInputType.Name
if type == "MouseButton1" or type == "Touch" then
Deactivate()
end
end
function SheetsButtonPressed(Object)
local type = Object.UserInputType.Name
if type == "MouseButton1" or type == "Touch" then
ToggleSheets()
end
end
function SheetsEdited(property)
if property == "Text" then
local bounds = SheetsGui.Sheet.ScrollingFrame.TextBox.TextBounds
SheetsGui.Sheet.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, math.max(14, bounds.Y))
end
end
----------------------------------
-----------CONNECTIONS------------
----------------------------------
PianoKeysConnections = {}
ExitButtonConnection = nil
SheetsButtonConnection = nil
SheetsEditedConnection = nil
function MakeGuiConnections()
for i, v in pairs(PianoGui.Keys:GetChildren()) do
PianoKeysConnections[i] = v.InputBegan:connect(function(Object) PianoKeyPressed(Object, tonumber(v.Name)) end)
end
ExitButtonConnection = PianoGui.ExitButton.InputBegan:connect(ExitButtonPressed)
SheetsButtonConnection = PianoGui.SheetsButton.InputBegan:connect(SheetsButtonPressed)
SheetsEditedConnection = SheetsGui.Sheet.ScrollingFrame.TextBox.Changed:connect(SheetsEdited)
end
function BreakGuiConnections()
for i, v in pairs(PianoKeysConnections) do
v:disconnect()
end
ExitButtonConnection:disconnect()
SheetsButtonConnection:disconnect()
SheetsEditedConnection:disconnect()
end
----------------------------------
----------------------------------
----------------------------------
----------SOUND CONTROL-----------
----------------------------------
----------------------------------
----------------------------------
----------------------------------
------------VARIABLES-------------
----------------------------------
ContentProvider = game:GetService("ContentProvider")
SoundFolder = Gui.SoundFolder
SoundList = {"9274816352", "9275244946", "9275263436", "9275278180", "9275278180", "9275278180", "9275324816"}
ExistingSounds = {}
----------------------------------
------------FUNCTIONS-------------
----------------------------------
function PreloadAudio()
for i, v in pairs(SoundList) do
ContentProvider:Preload("http://www.roblox.com/asset/?id="..v)
end
end
function PlayNoteSound(note1, source, range)
local note2 = (note1 - 1)%12 + 1 -- Which note? (1-12)
local octave = math.ceil(note1/12) -- Which octave?
local sound = math.ceil(note2/2) -- Which audio?
local offset = 16 * (octave - 1) + 8 * (1 - note2%2) -- How far in audio?
local audio = Instance.new("Sound", SoundFolder) -- Create the audio
audio.SoundId = "https://roblox.com/assets/?id="..SoundList[sound] -- Give its sound
if source then
--local range = 100
local a = 1/range^2
local distance = (game.Workspace.CurrentCamera.CoordinateFrame.p - source).magnitude
local volume = -a*distance^2 + 1
if volume < 0.05 then
audio:remove()
return
end
audio.Volume = volume
end
audio.TimePosition = offset + (octave - .9)/15 -- set the time position
audio:Play() -- Play the audio
table.insert(ExistingSounds, 1, audio)
if #ExistingSounds >= 10 then
ExistingSounds[10]:Stop() -- limit the number of playing sounds!
ExistingSounds[10] = nil
end
delay(4, function() audio:Stop() audio:remove() end ) -- remove the audio in 4 seconds, enough time for it to play
end
----------------------------------
----------------------------------
----------------------------------
----------CAMERA/PLAYER-----------
----------------------------------
----------------------------------
----------------------------------
----------------------------------
------------VARIABLES-------------
----------------------------------
Camera = game.Workspace.CurrentCamera
controllers = {}
ControllerService = game:GetService("ControllerService")
----------------------------------
------------FUNCTIONS-------------
----------------------------------
function Jump(jump)
local character = Player.Character
if character then
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
humanoid.Jump = jump
end
end
end
function HumanoidChanged(humanoid, property)
--print(property)
if property == "Jump" then
humanoid.Jump = false
elseif property == "Sit" then
humanoid.Sit = true
elseif property == "Parent" then
Deactivate()
Abort()
end
end
function HumanoidDied()
Deactivate()
end
function SetCamera(cframe)
Camera.CameraType = Enum.CameraType.Scriptable
Camera:Interpolate(cframe, cframe + cframe.lookVector, .5)
--Camera.CoordinateFrame = cframe
end
function ReturnCamera()
Camera.CameraType = Enum.CameraType.Custom
end
----------------------------------
-----------CONNECTIONS------------
----------------------------------
HumanoidChangedConnection = nil
HumanoidDiedConnection = nil
function MakePreventJumpConnections()
local character = Player.Character
if character then
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
HumanoidChangedConnection = humanoid.Changed:connect(function(property)
HumanoidChanged(humanoid, property)
end)
HumanoidDiedConnection = humanoid.Died:connect(HumanoidDied)
end
end
end
function BreakPreventJumpConnections()
HumanoidChangedConnection:disconnect()
HumanoidDiedConnection:disconnect()
end
----------------------------------
----------------------------------
----------------------------------
---------INITIATE SCRIPT----------
----------------------------------
----------------------------------
----------------------------------
ScriptReady = true
PreloadAudio()
like i said, instead of that try using
ContentProvider = game:GetService("ContentProvider")
SoundFolder = Gui.SoundFolder
SoundList = {"9274816352", "9275244946", "9275263436", "9275278180", "9275278180", "9275278180", "9275324816"}
ExistingSounds = {}
----------------------------------
------------FUNCTIONS-------------
----------------------------------
function PreloadAudio()
for i, v in pairs(SoundList) do
ContentProvider:Preload("rbxassetid://="..v)
end
end
function PlayNoteSound(note1, source, range)
local note2 = (note1 - 1)%12 + 1 -- Which note? (1-12)
local octave = math.ceil(note1/12) -- Which octave?
local sound = math.ceil(note2/2) -- Which audio?
local offset = 16 * (octave - 1) + 8 * (1 - note2%2) -- How far in audio?
local audio = Instance.new("Sound", SoundFolder) -- Create the audio
audio.SoundId = "rbxassetid://"..SoundList[sound] -- Give its sound
if source then
--local range = 100
local a = 1/range^2
local distance = (game.Workspace.CurrentCamera.CoordinateFrame.p - source).magnitude
local volume = -a*distance^2 + 1
if volume < 0.05 then
audio:remove()
return
end
audio.Volume = volume
end
audio.TimePosition = offset + (octave - .9)/15 -- set the time position
audio:Play() -- Play the audio
table.insert(ExistingSounds, 1, audio)
if #ExistingSounds >= 10 then
ExistingSounds[10]:Stop() -- limit the number of playing sounds!
ExistingSounds[10] = nil
end
delay(4, function() audio:Stop() audio:remove() end ) -- remove the audio in 4 seconds, enough time for it to play
end
if that doesnt work, try again in a few days, roblox sound loading hasnt been reliable recently (jailbreak live event flashback)
ok im testing that right now