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
 

Re: ROBLOX, fix TimeLength now.

Previous Thread :: Next Thread 
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 11:11 AM
The following script is supposed to add support for different music in different areas in a certain world, yet when run in play solo, it constantly fires for reasons I do not know, giving the error, "Maximum re-entrancy exceeded"

Any help on why would be appreciated.


function Music()
twopart = false
if (script.Music2.SoundId ~= "http://www.roblox.com/asset/?id=0") then
twopart = true
else
twopart = false
end
play = true
while (play == true) do
if (twopart == true) then
script.Music1.Looped = false
script.Music1:Play()
Wait(script.Music1.TimeLength)
script.Music2:Play()
Wait(script.Music2.TimeLength)
elseif (twopart == false) then
script.Music1.Looped = true
script.Music1:Play()
end
end
end

script.Music1.Changed:connect(Music)
Music()
Report Abuse
BlueWizard12345 is not online. BlueWizard12345
Joined: 31 Mar 2012
Total Posts: 906
13 Jun 2015 11:13 AM
If Music1 is playing, then it it being changed constantly. The timelength is the changing property of it.
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 11:15 AM
I thought TimePosition was the changing property?


choo choo
Report Abuse
BlueWizard12345 is not online. BlueWizard12345
Joined: 31 Mar 2012
Total Posts: 906
13 Jun 2015 11:23 AM
Timeposition, my mistake.
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 11:25 AM
So... Any clues on why this doesn't work?


choo choo
Report Abuse
97neko is not online. 97neko
Joined: 14 Sep 2014
Total Posts: 16159
13 Jun 2015 11:35 AM
have you ever heard of a table...

mr developer man
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 11:36 AM
How would a table help me here...?


choo choo
Report Abuse
97neko is not online. 97neko
Joined: 14 Sep 2014
Total Posts: 16159
13 Jun 2015 11:41 AM
local m = script:GetChildren()
for i,v in ipairs(m) do
if v:IsA('Sound') then
v:Play()
wait(v.TimeLength)
end
end

mr developer man
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
13 Jun 2015 11:41 AM
BlueWizard just told you why it doesn't work. Changed fires whenever any property is changed. When you play a song, it changes IsPaused and IsPlaying once, and TimePosition for the rest of the duration of the audio.
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
13 Jun 2015 11:42 AM
Oh, and you are changing Looped, which causes Changed to fire *another* time.
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 11:42 AM
@Jode Oh lol. I didn't quite get that from his explanation.


choo choo
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 11:43 AM
So how should I go about remedying this?


choo choo
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
13 Jun 2015 11:46 AM
Changed passes a string indicating the name of the property that was changed. I assume you only care about one property changing in particular; just check if the string matches the name of that property before executing the code.
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 12:01 PM
Got it working, thanks guys!


choo choo
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 12:37 PM
After a bit testing to see if everything works, I found that studio will crash if I go into an area that plays a one-part track, then into an area that plays a different one-part track, and I do not know why.


choo choo
Report Abuse
xXZerzavyXx is not online. xXZerzavyXx
Joined: 29 Oct 2008
Total Posts: 6581
13 Jun 2015 12:40 PM
@OP

I've been looking for such a script myself for a week now.

I always explain the idea of different music player in different areas but I can never find a solution. Mind posting the finished working script?
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
13 Jun 2015 01:08 PM
Uh... Sure? Still has quite a few bugs to be worked out but ok.

http://www.roblox.com/Area-Tracks-item?id=258433121


choo choo
Report Abuse
amirmohammadi360 is not online. amirmohammadi360
Joined: 25 Jan 2016
Total Posts: 1
21 Jun 2017 06:02 PM
hey can you help me with a script that plays songs in different areas and i have one script that does that but the problem is that it only works n solo mode and not in online mode plz help me


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