MusicPlayer Event

Hello! I wanted to make a textbox in which the player types an audio ID and when they press enter, the remote event fires and the SoundId in the boombox changes to the ID the player typed in the textbox.

Here is the LocalScript inside the textbox:

local box = script.Parent

box.FocusLost:Connect(function(enterpressed)
	if enterpressed then
		game.ReplicatedStorage.Music.CustomID:FireServer()
	end
end)

And here’s the server script inside ServerScriptService:

local remote = game.ReplicatedStorage.Music.CustomID
local SoundObject = game.Workspace.Boombox.Sound

remote.OnServerEvent:Connect(function(plr)
	SoundObject.SoundId = "rbxassetid://"..plr.PlayerGui.MusicPlayer.ImageLabel.TextBox.Text
end)

I tested it multiple times, the event fired and the SoundId changed to just “rbxassetid://” without the text the player typed in. The “ClearTextOnFocus” property in the textbox is also disabled. Any help is appreciated

1 Like
local box = script.Parent

box.FocusLost:Connect(function(enterpressed)
	if enterpressed then
		game.ReplicatedStorage.Music.CustomID:FireServer(box.Text)
	end
end)
local remote = game.ReplicatedStorage.Music.CustomID
local SoundObject = game.Workspace.Boombox.Sound

remote.OnServerEvent:Connect(function(plr, text)
	SoundObject.SoundId = "rbxassetid://"..text
end)
1 Like

I tested this and it works, thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.