|
| 22 Jul 2014 05:42 PM |
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 |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 05:45 PM |
cam = game.Workspace.CurrentCamera mus = game.Workspace.MapValue m = script.Music
if mus.Value == 3 then wait() local m1 = cam:FindFirstChild(m.Name) if m1 then m1:Destroy() end 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 Spawn(wait) do onStop() end |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 05:52 PM |
| That script crashes studio.. |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jul 2014 05:55 PM |
| you used the wrong free model noob |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 06:05 PM |
This isn't a free model.
My guess is that I make this part a function
if mus.Value == 3 then wait() m = script.Music mt = m:Clone() mt.Parent = cam mt:Play() end
and then make it so it only runs once. Though I'm kinda confused on how to do that. |
|
|
| Report Abuse |
|
|
| |
|
| |
|