So this script will clone music and place it in a users camera when a map loads. Everything works fine, except when a player dies, the music is cloned again, and now you have the same song playing twice, this repeats itself every time a player dies. In test mode I can see the music multiplying in the camera on a players death. How do I stop this from happening?
cam = game.Workspace.CurrentCamera
mus = game.Workspace.MapValue
if mus.Value == 3 then
wait()
m = script.Music
mt = m:Clone()
mt.Parent = cam
mt:Play()
end
function onStop()
if mus.Value == 0 then
wait()
mz = cam:findFirstChild("Music")
if mz then
mz:Stop()
mz:Destroy()
end
end
end
while true do
onStop()
wait()
end
