Sound not playing

Hi! I’m basically remaking the BoomBox into a more modern way (click a button to open a gui, enter the audio id → it welds the BoomBox to your back and plays the sound).

My problem is that the sound doesn’t play at all. Any idea what is causing this? The audios load and play in Toolbox without any problems, just not in-game in the BoomBox.

LocalScript

local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local gui = plr.PlayerGui:WaitForChild("HUD").BoomboxMenu

repeat wait() until plr.Character

local TextBox = script.Parent.Box
local PlayButton = script.Parent.Play

local RS = game:GetService("ReplicatedStorage")
local EventBoombox = RS:FindFirstChild("BoomboxEvent")

PlayButton.MouseButton1Click:Connect(function()
	if TextBox.Text ~= "" then
		gui:TweenPosition(UDim2.new(0.5,0,1.5,0), 'InOut', 'Sine', 1)
		EventBoombox:FireServer("play", TextBox.Text)
		wait(1.5)
		gui.Visible = false
		TextBox.Text = ""
	elseif TextBox.Text == "" then
		gui:TweenPosition(UDim2.new(0.5,0,1.5,0), 'InOut', 'Sine', 1)
		EventBoombox:FireServer("remove", TextBox.Text)
		wait(1.5)
		gui.Visible = false
		TextBox.Text = ""
	end
end)

ServerScript

local RS = game:GetService("ReplicatedStorage")
local BoomboxPart = RS:FindFirstChild("BoomboxPart")
local BoomboxEvent = RS:FindFirstChild("BoomboxEvent")

local TS = game:GetService("TweenService")

local info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true)

local function playMusic(tween, partClone, soundId)
	tween:Play()
	partClone.Sound.SoundId = "rbxassetid://"..soundId
	partClone.Sound:Play()
	partClone.Sound.Looped = true
end

BoomboxEvent.OnServerEvent:Connect(function(plr, value, soundId)
	if value == "play" then
		if plr.Character:WaitForChild("HumanoidRootPart"):FindFirstChild("BoomboxPart") then
			local part = plr.Character:WaitForChild("HumanoidRootPart"):FindFirstChild("BoomboxPart")
			local tween = TS:Create(part, info, {Size = Vector3.new(3.499, 1.75, 1.312)})
			playMusic(tween, part, soundId)
		else
			local partClone = BoomboxPart:Clone()
			partClone.Parent = plr.Character:WaitForChild("HumanoidRootPart")
			local weld = partClone:WaitForChild("Weld")
			weld.Part0 = partClone
			weld.Part1 = plr.Character:WaitForChild("HumanoidRootPart")
			local tween = TS:Create(partClone, info, {Size = Vector3.new(3.499, 1.75, 1.312)})
			playMusic(tween, partClone, soundId)
		end
	elseif value == "remove" then
		local BoomboxPart = plr.Character:WaitForChild("HumanoidRootPart"):FindFirstChild("BoomboxPart")
		BoomboxPart.Sound:Stop()
		BoomboxPart:Destroy()
	end
end)

I think your playMusic function works fine… There may be an issue where you’re calling it. Have you tried using print statements or breakpoints to debug?

Not really. Though I checked the properties in-game testing and it loaded and even played the sound (the timePosition kept increasing)… which is really weird.

Maybe you’re volume is just really low…

It’s not, it’s at full level + as I said, it works in Toolbox.

Have you tried publishing and trying in an actual server?

I can’t publish it yet, because the game is already released and I don’t want to publish an update that doesn’t work.

I see, sorry. You could bring the code into a testing world or baseplate and do it there.

Just did that and even tried it in-game, it still doesn’t play any audio. I also noticed that the tween doesn’t really work. Well it keeps changing the size in the Properties but I don’t actually see it getting re-sized. Any idea?

Where are both of your scripts located in the explorer?

Okay, I’ve plugged your code into studio and it works perfect for me. This is so strange.

Also do you mean the boombox size tween?

Yes, the tween that changes the boombox’s size.

LocalScript is in an ImageLabel which is inside a ScreenGui. ServerScript is in SSS

and you said this tween isn’t working? It’s a singular part (or meshPart), right?

Yes, it’s a part with a mesh in it (it’s the classic Boombox). It’s not a model.

https://gyazo.com/f6547b9b8b86302eae5ad515fa2fc006

That’s weird. It doesn’t really work for me. (neither the sound and neither the tweening)

Try replacing the boombox mesh with a part like I did. Check if it still doesn’t tween.

Yeah that makes sense I assume, but what about the sound? That is little bit worse.