How do I fix this error? When player1 syncs to player2, they hear player2’s music, but when player2 moves onto a different song, player1 doesn’t hear the new song? To hear the new song, player 1 has to unsync and then re-sync to player2 to hear their audio. (Please use headphones for the example video. Player 2’s Audio is on the left while player 1’s audio is on the right)
https://streamable.com/j3y1fq
enabled = false
local Parent = script.Parent
local LocalPlayer = game.Players.LocalPlayer
local repService = game:GetService("ReplicatedStorage")
local musicRemote = repService:WaitForChild("MusicValue")
function onActivated()
if enabled == false then
Parent.dancepart.Position = LocalPlayer.Character.Head.Position
Parent.dancepart.SongLoop:Play()
musicRemote:FireServer(script.Parent, true, script.Parent.dancepart.SongLoop)
enabled = true
while true do
wait(1)
Parent.dancepart.Position = LocalPlayer.Character.Head.Position
if enabled == false then
else
end
end
else
Parent.dancepart.SongLoop:Stop()
enabled = false
end
end
function onUnequipped()
Parent.dancepart.SongLoop:Stop()
enabled = false
musicRemote:FireServer(script.Parent, false, script.Parent.dancepart.SongLoop)
end
Parent.Activated:Connect(onActivated)
Parent.Unequipped:Connect(onUnequipped)