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 » Scripters
Home Search
 

When I die another song plays :|

Previous Thread :: Next Thread 
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:30 AM
Everything is fine the it plays the music perfectly until I die it plays 2 songs at a time... I own a 2d speed run so lots of people are going to die. So please help.

gw=game.Workspace
last=""
lastlast=""
while true do
wait(1)
local tracks=script:GetChildren()
local rn=math.random(1,#tracks)
local track=tracks[rn]
if track~=nil then
if track.className=="Sound" and track.Name~=last and track.Name~=lastlast then
lastlast=last
last=track.Name
track:play()
wait(80)
end
end
end



Sorry. You can only view this signature if you have a ROBLOX™ Builders Club.
Report Abuse
mightybaseplate is not online. mightybaseplate
Joined: 28 Aug 2010
Total Posts: 7660
16 Oct 2015 10:33 AM
is it in localscript?

you could do a for loop and :Stop() them all on respawn
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:34 AM
Yes



Sorry. You can only view this signature if you have a ROBLOX™ Builders Club.
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:34 AM
Oh never mind no



Sorry. You can only view this signature if you have a ROBLOX™ Builders Club.
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:36 AM
I've been messing with this script for a while just not able to fix it.



Sorry. You can only view this signature if you have a ROBLOX™ Builders Club.
Report Abuse
mightybaseplate is not online. mightybaseplate
Joined: 28 Aug 2010
Total Posts: 7660
16 Oct 2015 10:37 AM
"you could do a for loop and :Stop() them all on respawn"
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
16 Oct 2015 10:37 AM
OOO WATCHA SAAAAY
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:39 AM
Mighty I'm sorry I'm new at scripting I don't know exactly how to add that in.



Sorry. You can only view this signature if you have a ROBLOX™ Builders Club.
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:40 AM
Without errors anyway.



Sorry. You can only view this signature if you have a ROBLOX™ Builders Club.
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:43 AM
You think you could help me out?



Sorry. You can only view this signature if you have ROBLOX™ Builders Club.
Report Abuse
mightybaseplate is not online. mightybaseplate
Joined: 28 Aug 2010
Total Posts: 7660
16 Oct 2015 10:44 AM
Yes I can. Let me write it real quick
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:45 AM
Thank you so much!



Sorry. You can only view this signature if you have ROBLOX™ Builders Club.
Report Abuse
mightybaseplate is not online. mightybaseplate
Joined: 28 Aug 2010
Total Posts: 7660
16 Oct 2015 10:46 AM
Solution 1:
gw=game.Workspace
last=""
lastlast=""
for i,v in next,script:getChildren() do
if v.ClassName == "Sound" then
v:Stop()
end
end
while true do
wait(1)
local tracks=script:GetChildren()
local rn=math.random(1,#tracks)
local track=tracks[rn]
if track~=nil then
if track.className=="Sound" and track.Name~=last and track.Name~=lastlast then
lastlast=last
last=track.Name
track:play()
wait(80)
end
end
end


Solution 2:
StarterGui.ResetPlayerGuiOnSpawn = false
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:48 AM
Thanks so much!



Sorry. You can only view this signature if you have ROBLOX™ Builders Club.
Report Abuse
EndlessMoney is not online. EndlessMoney
Joined: 22 Sep 2013
Total Posts: 573
16 Oct 2015 10:52 AM
Hmm for some reason it did not work. It worked for a couple of deaths then failed.



Sorry. You can only view this signature if you have ROBLOX™ Builders Club.
Report Abuse
mightybaseplate is not online. mightybaseplate
Joined: 28 Aug 2010
Total Posts: 7660
16 Oct 2015 11:02 AM
try solution 2. it should be working i dont know how you bumped it up
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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