What do you want to achieve? Basically I want a player to change the id of a song in a text box and as soon as he presses a text button it will change the id for all players on the server to the id he entered.
What is the issue? The player only changes the song id for itself.
What solutions have you tried so far? to try to solve this problem I thought of using a RemoteEvent to send the id typed to the server and it would distribute to all clients but I was not successful
Below is everything I’ve done so far (this in theory should take the id typed by the player and take it to the server) I don’t know if I’m doing it the right way because I’m new to this area. If you can, help me at least by explaining better how to do it.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Musicidn = Instance.new("RemoteEvent")
Musicidn.Name = "SoundAll"
Musicidn.Parent = ReplicatedStorage
local button = script.Parent.Playb
local box = script.Parent.SoundTextBox
local music = game.StarterGui.SoundManager.SoundRegions.Dogp.Sound
--script--
Musicidn:FireServer(button.MouseButton1Click:Connect(function()
music.SoundId = "rbxassetid://"..box.Text
music:Play()
end))```
A few questions.
Where is the music located, is it created on the client or server?
Where is the music parented?
Can you show the code that receives the remote event when it reaches the server?
As @SelDraken said, you need to give us more information.
Also, you have the sound in the StarterGui. That’s local to the player, so it isn’t a Global sound.
I would put the Sounds inside a Part in the Workspace and use that Part as the source of the sound. It will be full volume inside the Part, and decrease according to the distance the Player is from the Part when you change the RollOff distances.
Initially, the song was located in each player’s Gui, but now I’ve changed its location to a tile in Workspace, as recommended by @Scottifly .So now the sound is on a block in the workspace
Nothing is working, when the client changes the id it creates the event only for itself.
This is the code I’m trying to use to receive the event from the server and transfer it to all clients :
local Musicidn = ReplicatedStorage:WaitForChild('SoundAll')
Musicidn.OnServerEvent:FireAllClients()```
Maybe open that event receiver up a bit and put a breakpoint in it or a print statement, to make sure you are actually getting the message sent to the server.
local Musicidn.OnServerEvent:Connect(function()
print("Musicidn event recieved")
end)
It seems to me your instantiating a remote event from the client, which will not successfully pass through to the server. I would suggest creating the remote event in studio and then referencing the event from the scripts.
Updates
I managed to solve it guys, thanks to everyone who tried to help xD
Help for others who try something like this
If you’re going to do something like that, try to be inspired by the roblox boombox as it uses the same system.
I will not release all the scripts I used but I will leave here for you the script that sends the Id for the event in replicated storage. Just make your own script to fire your event by clicking the Play button.
if songid == 0 then
game.Workspace.Dogp.Sound:Stop()-- your sound stop
else
game.Workspace.Dogp.Sound.SoundId = "rbxassetid://".. songid--your soundid
game.Workspace.Dogp.Sound:Play()--your sound
end
end)