Client sided music tool

This script is supposed to play client sided music when clicked, but other people can still hear the music of others. What’s wrong here?

enabled = false
local Parent = script.Parent
local LocalPlayer = game.Players.LocalPlayer
function onActivated()
	if enabled == false then
		Parent.dancepart.Position = LocalPlayer.Character.Head.Position
		Parent.dancepart.SongLoop:Play()
		enabled = true
		while true do
			wait(1)
			Parent.dancepart.Position = LocalPlayer.Character.Head.Position
			if enabled ~= false then

			else
				break
			end		
		end
	else
		Parent.dancepart.SongLoop:Stop()
		enabled = false
	end
end
function onUnequipped()
	Parent.dancepart.SongLoop:Stop()
	enabled = false
end
Parent.Activated:connect(onActivated)
Parent.Unequipped:connect(onUnequipped)
1 Like

Something here should be able to help?

Make sure the physical script is a local script. If it is, put the sound in replicated storage or replicated first and fix the code accordingly. Sorry if my solution doesn’t work.

Where are you keeping this script?

I am keeping it inside the actual tool.

Are you getting anything in your output?