So I'm trying to create a server script that plays audio to the whole server, I've tried this on a local script, just testing to see if at least one player can hear the audio. It worked perfectly on the local script, I tried pasting the same script into a server script and it didn't play anything, all it did was insert the text rbxassetid:// into sound id.
Here's the code:
-- \\ CONTROL SCRIPT
local textbox = script.Parent.TextBox
local textbutton = script.Parent.TextButton
textbutton.MouseButton1Click:Connect(function()
tostring(textbox.Text)
game.Workspace.Sound.SoundId = "rbxassetid://"..textbox.Text
end)
Can someone help me out? Thanks! :)

8 comments
Thanks for the help but can you help me make this event? I've never really touched remote functions of events before..
Forgot to mention, I do know how to fire the remote event but I dont know how to send the textbox text to the event.
Sorry for the late reply, but basically, when you fire the event you send it in like this: RemoteEvent:FireServer(text)
And on the server, you catch it like this: RemoteEvent.OnServerEvent:Connect(function(text) --do code end)
Take a look at this page if you need more help with that: https://developer.roblox.com/en-us/api-reference/class/RemoteEvent
I've done all of that but I get the error "attempt to concatenate string with Instance" what does this mean and what do I do?
Oh sorry, on the server it would be caught like this: "RemoteEvent.OnServerEvent:Connect(function(player, text) --do code end)" because the first parameter is always the player who fired the event.
Really sorry for annoying you with this but now it says this: Failed to load sound rbxassetid://: Unable to download sound data (x2) and it isn't showing the text from the textbox.