Tunnells
(PlaySage)
February 16, 2021, 8:52am
#1
So basically Im trying to make A sound player, but if i input a song it wont play and gives me this error
game.ReplicatedStorage.MusicPlay.OnServerEvent:Connect(function(Players)
print("Event Made it")
sound.SoundId = "rbxassetid://".. game.StarterGui.Music.Frame.TextBox.Text
sound:Play()
end)‘’’
but it gives me this error Failed to load sound rbxassetid://: Unable to download sound data (x2)
1 Like
lluckvy
(aaron)
February 16, 2021, 8:56am
#2
Tunnells:
sound
Where do you define sound? Can we see your variables?
If you’re trying to access the text of something, this is not a good way to do so. StarterGui is a service, anything inputted into a textbox will not replicate here, it only shows in a specific player’s PlayerGui. What I would do instead is fire the sound ID with the event as well so it will be passed onto the server.
Tunnells
(PlaySage)
February 16, 2021, 8:59am
#3
local sound = game.Workspace.RadioMesh.Sound
local button = game.StarterGui.Music.Frame.TextButton
local IDN = game.StarterGui.Music.Frame.TextBox
Tunnells
(PlaySage)
February 16, 2021, 9:00am
#4
i used IDN then i changed it cause its not working
MahDev0
(MahDev)
February 16, 2021, 9:01am
#5
When you send massage to server you should put variable text in it like that
FireServer(PlaceOfTextLabel.Text)
And when call it in server make that
game.ReplicatedStorage.MusicPlay.OnServerEvent(plr, text)
Sound.SoundId = "rbxassetid://"..text
Tunnells
(PlaySage)
February 16, 2021, 9:04am
#6
Let me test to see if it works
Apicphis
(Apicphis)
February 16, 2021, 9:06am
#7
This is unrelated to the issue you’re having, but you should also be checking whether the ID is a valid audio before playing it.
Tunnells
(PlaySage)
February 16, 2021, 9:07am
#8
It is valid i use raining tacos to check
Apicphis
(Apicphis)
February 16, 2021, 9:07am
#9
But, what if a player enters something that isn’t an audio?
Tunnells
(PlaySage)
February 16, 2021, 9:08am
#10
The gui is only gonna show up for me i was using a song id
Tunnells
(PlaySage)
February 16, 2021, 9:09am
#11
well i still have the same error
Server
local button = game.StarterGui.Music.Frame.TextButton
local IDN = game.StarterGui.Music.Frame.TextBox
game.ReplicatedStorage.MusicPlay.OnServerEvent:Connect(function(plr, text)
print("Event Made it")
sound.SoundId = "rbxassetid://"..text
sound:Play()
end)
Client
local TextPlace = game.StarterGui.Music.Frame.TextBox
button.MouseButton1Click:Connect(function()
game.ReplicatedStorage.MusicPlay:FireServer(TextPlace.Text)
end)
Tunnells
(PlaySage)
February 16, 2021, 9:10am
#12
09:06:57.621 Failed to load sound rbxassetid://: Unable to download sound data (x2) -
Tunnells
(PlaySage)
February 16, 2021, 9:10am
#13
it doesnt show the sound id
Apicphis
(Apicphis)
February 16, 2021, 9:10am
#14
Use tonumber(SoundId) to make the ID a number instead of a string
MahDev0
(MahDev)
February 16, 2021, 9:11am
#15
Try another id or print text in server script
Tunnells
(PlaySage)
February 16, 2021, 9:13am
#16
i tried but it gives me this error 09:11:50.332 Failed to load sound rbxassetid://: Unable to download sound data (x2) - Studio
Apicphis
(Apicphis)
February 16, 2021, 9:13am
#17
That means the audio you entered isn’t actually an audio ID, or the audio is deleted. This is why I suggested you check these before playing it.
Tunnells
(PlaySage)
February 16, 2021, 9:14am
#18
But im able to play the song in Studio without the script
MahDev0
(MahDev)
February 16, 2021, 9:16am
#19
Bro there problem in your script in client this problem
local TextPlace = game.StarterGui.Music.Frame.TextBox
Should write
script.Parent
Because all children in gui get copied and go to playergui
Apicphis
(Apicphis)
February 16, 2021, 9:17am
#20
Try a different audio id and see if you get the same error