generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Something is wrong with this script.

Previous Thread :: Next Thread 
QuillStrike is not online. QuillStrike
Joined: 09 Jan 2013
Total Posts: 107
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
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
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
QuillStrike is not online. QuillStrike
Joined: 09 Jan 2013
Total Posts: 107
22 Jul 2014 05:52 PM
That script crashes studio..
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
22 Jul 2014 05:54 PM
maybe u copied it wrong?
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
22 Jul 2014 05:55 PM
you used the wrong free model noob
Report Abuse
QuillStrike is not online. QuillStrike
Joined: 09 Jan 2013
Total Posts: 107
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
QuillStrike is not online. QuillStrike
Joined: 09 Jan 2013
Total Posts: 107
22 Jul 2014 06:21 PM
Bump
Report Abuse
QuillStrike is not online. QuillStrike
Joined: 09 Jan 2013
Total Posts: 107
22 Jul 2014 06:43 PM
Anyone? D:
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image