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: Pausing

Previous Thread :: Next Thread 
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 07:32 PM
I tried actually pausing it before, and that didn't work, so I took a stab at setting the pitch to 0, and it doesn't work either. I am sure it should work, but what is wrong with this?:

local play = script.Parent.Play
local pause = script.Parent.Pause
local stop = script.Parent.Stop
local playtime = script.Parent.TextLabel
local sec = 00
local minute = 00
local hour = 00
pitchplus = script.Parent.PitchEditor.Plus1
pitchminus = script.Parent.PitchEditor.Minus1
pitch = script.Parent.PitchEditor.Pitch
volumeplus = script.Parent.VolumeEditor.Plus1
volumeminus = script.Parent.VolumeEditor.Minus1
volume = script.Parent.VolumeEditor.Volume

play.MouseButton1Down:connect(function()
local check = game.Soundscape:FindFirstChild("Sound")
if not check then
local id = script.Parent.idholder.Text
s = Instance.new("Sound", game.Soundscape)
s.SoundId = "http://roblox.com/asset/?id="..id
s:Play()
repeat
wait(1)
sec = sec + 1
if sec == 60 then
sec = sec - 60
minute = minute + 1
if minute == 60 then
minute = minute - 60
hour = hour + 1
end
end
playtime.Text = hour..":"..minute..":"..sec
until s.Pitch == 0
else
check.Pitch = pitch
repeat
wait(1)
sec = sec + 1
if sec == 60 then
sec = sec - 60
minute = minute + 1
if minute == 60 then
minute = minute - 60
hour = hour + 1
end
end
playtime.Text = hour..":"..minute..":"..sec
until s.Pitch == 0
end
end)
pause.MouseButton1Down:connect(function()
if s then
s.Pitch = 0
end
end)
stop.MouseButton1Down:connect(function()
if s then
s:Stop()
s:Destroy()
s = nil
playtime.Text = "0:0:0"
sec = 00
minute = 00
hour = 00
end
end)
script.Parent.Pitch.MouseEnter:connect(function()
script.Parent.Pitch.BackgroundColor3 = Color3.new(0,0,0)
end)
script.Parent.Pitch.MouseLeave:connect(function()
script.Parent.Pitch.BackgroundColor3 = Color3.new(255,255,255)
end)
script.Parent.Pitch.MouseButton1Down:connect(function()
script.Parent.Pitch.Visible = false
script.Parent.PitchEditor.Visible = true
end)
script.Parent.Volume.MouseEnter:connect(function()
script.Parent.Volume.BackgroundColor3 = Color3.new(0,0,0)
end)
script.Parent.Volume.MouseLeave:connect(function()
script.Parent.Volume.BackgroundColor3 = Color3.new(255,255,255)
end)
script.Parent.Volume.MouseButton1Down:connect(function()
script.Parent.Volume.Visible = false
script.Parent.VolumeEditor.Visible = true
end)
script.Parent.LoopBool.MouseEnter:connect(function()
script.Parent.LoopBool.BackgroundColor3 = Color3.new(0,0,0)
end)
script.Parent.LoopBool.MouseLeave:connect(function()
script.Parent.LoopBool.BackgroundColor3 = Color3.new(255,255,255)
end)
script.Parent.LoopBool.MouseButton1Down:connect(function()
script.Parent.LoopBool.Visible = false
script.Parent.LoopBoolEditor.Visible = true
end)
pitchplus.MouseButton1Down:connect(function()
s.Pitch = s.Pitch + .01
pitch.Text = s.Pitch
end)
pitchminus.MouseButton1Down:connect(function()
local pitchcheck = s.Pitch
if pitchcheck == .01 then
s.Pitch = .01
elseif pitchcheck >= .2 then
s.Pitch = s.Pitch - .01
end
pitch.Text = s.Pitch
end)
script.Parent.PitchEditor.closepitch.MouseButton1Down:connect(function()
script.Parent.PitchEditor.closepitch.Parent.Visible = false
script.Parent.Pitch.Visible = true
end)
volumeplus.MouseButton1Down:connect(function()
local volumecheck = s.Volume
if volumecheck == 1 then
s.Volume = 1
volume.Text = s.Volume
elseif volumecheck < 1 then
s.Volume = s.Volume + .01
volume.Text = s.Volume
end
end)
volumeminus.MouseButton1Down:connect(function()
local volumecheck2 = s.Volume
if volumecheck2 >= .01 then
s.Volume = s.Volume - .01
volume.Text = s.Volume
elseif volumecheck2 == .01 then
s.Volume = .01
volume.Text = s.Volume
end
end)
script.Parent.VolumeEditor.closevolume.MouseButton1Down:connect(function()
script.Parent.VolumeEditor.Visible = false
script.Parent.Volume.Visible = true
end)
script.Parent.LoopBoolEditor.nocheck.MouseButton1Down:connect(function()
script.Parent.LoopBoolEditor.nocheck.Visible = false
script.Parent.LoopBoolEditor.check.Visible = true
s.Looped = true
end)
script.Parent.LoopBoolEditor.check.MouseButton1Down:connect(function()
script.Parent.LoopBoolEditor.check.Visible = false
script.Parent.LoopBoolEditor.nocheck.Visible = true
s.Looped = false
end)
script.Parent.LoopBoolEditor.closeloopbooleditor.MouseButton1Down:connect(function()
script.Parent.LoopBoolEditor.Visible = false
script.Parent.LoopBool.Visible = true
end)
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 07:49 PM
bump
Report Abuse
InternalRecursion is not online. InternalRecursion
Joined: 30 Dec 2012
Total Posts: 349
22 Jun 2013 08:03 PM
If there is an output, it would help.
I skimmed through the code, and I may be wrong on this, but try to use the sound's :Pause() method.
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 08:06 PM
sadly there is no output, but I will try what you said, because before I was using the IsPaused = true
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 08:15 PM
The changed script is this but it still won't play the sound when I hit play, however it does create the sound and start the timer. See the output below the script.

local play = script.Parent.Play
local pause = script.Parent.Pause
local stop = script.Parent.Stop
local playtime = script.Parent.TextLabel
local sec = 00
local minute = 00
local hour = 00
pitchplus = script.Parent.PitchEditor.Plus1
pitchminus = script.Parent.PitchEditor.Minus1
pitch = script.Parent.PitchEditor.Pitch
volumeplus = script.Parent.VolumeEditor.Plus1
volumeminus = script.Parent.VolumeEditor.Minus1
volume = script.Parent.VolumeEditor.Volume

play.MouseButton1Down:connect(function()
local check = game.Soundscape:FindFirstChild("Sound")
if not check then
local id = script.Parent.idholder.Text
s = Instance.new("Sound", game.Soundscape)
s.SoundId = "http://roblox.com/asset/?id="..id
s:Play()
repeat
wait(1)
sec = sec + 1
if sec == 60 then
sec = sec - 60
minute = minute + 1
if minute == 60 then
minute = minute - 60
hour = hour + 1
end
end
playtime.Text = hour..":"..minute..":"..sec
until s:Pause()
else
check.IsPaused = false
repeat
wait(1)
sec = sec + 1
if sec == 60 then
sec = sec - 60
minute = minute + 1
if minute == 60 then
minute = minute - 60
hour = hour + 1
end
end
playtime.Text = hour..":"..minute..":"..sec
until s.Pitch == 0
end
end)
pause.MouseButton1Down:connect(function()
if s then
s:Pause()
end
end)
stop.MouseButton1Down:connect(function()
if s then
s:Stop()
s:Destroy()
s = nil
playtime.Text = "0:0:0"
sec = 00
minute = 00
hour = 00
end
end)
script.Parent.Pitch.MouseEnter:connect(function()
script.Parent.Pitch.BackgroundColor3 = Color3.new(0,0,0)
end)
script.Parent.Pitch.MouseLeave:connect(function()
script.Parent.Pitch.BackgroundColor3 = Color3.new(255,255,255)
end)
script.Parent.Pitch.MouseButton1Down:connect(function()
script.Parent.Pitch.Visible = false
script.Parent.PitchEditor.Visible = true
end)
script.Parent.Volume.MouseEnter:connect(function()
script.Parent.Volume.BackgroundColor3 = Color3.new(0,0,0)
end)
script.Parent.Volume.MouseLeave:connect(function()
script.Parent.Volume.BackgroundColor3 = Color3.new(255,255,255)
end)
script.Parent.Volume.MouseButton1Down:connect(function()
script.Parent.Volume.Visible = false
script.Parent.VolumeEditor.Visible = true
end)
script.Parent.LoopBool.MouseEnter:connect(function()
script.Parent.LoopBool.BackgroundColor3 = Color3.new(0,0,0)
end)
script.Parent.LoopBool.MouseLeave:connect(function()
script.Parent.LoopBool.BackgroundColor3 = Color3.new(255,255,255)
end)
script.Parent.LoopBool.MouseButton1Down:connect(function()
script.Parent.LoopBool.Visible = false
script.Parent.LoopBoolEditor.Visible = true
end)
pitchplus.MouseButton1Down:connect(function()
s.Pitch = s.Pitch + .01
pitch.Text = s.Pitch
end)
pitchminus.MouseButton1Down:connect(function()
local pitchcheck = s.Pitch
if pitchcheck == .01 then
s.Pitch = .01
elseif pitchcheck >= .2 then
s.Pitch = s.Pitch - .01
end
pitch.Text = s.Pitch
end)
script.Parent.PitchEditor.closepitch.MouseButton1Down:connect(function()
script.Parent.PitchEditor.closepitch.Parent.Visible = false
script.Parent.Pitch.Visible = true
end)
volumeplus.MouseButton1Down:connect(function()
local volumecheck = s.Volume
if volumecheck == 1 then
s.Volume = 1
volume.Text = s.Volume
elseif volumecheck < 1 then
s.Volume = s.Volume + .01
volume.Text = s.Volume
end
end)
volumeminus.MouseButton1Down:connect(function()
local volumecheck2 = s.Volume
if volumecheck2 >= .01 then
s.Volume = s.Volume - .01
volume.Text = s.Volume
elseif volumecheck2 == .01 then
s.Volume = .01
volume.Text = s.Volume
end
end)
script.Parent.VolumeEditor.closevolume.MouseButton1Down:connect(function()
script.Parent.VolumeEditor.Visible = false
script.Parent.Volume.Visible = true
end)
script.Parent.LoopBoolEditor.nocheck.MouseButton1Down:connect(function()
script.Parent.LoopBoolEditor.nocheck.Visible = false
script.Parent.LoopBoolEditor.check.Visible = true
s.Looped = true
end)
script.Parent.LoopBoolEditor.check.MouseButton1Down:connect(function()
script.Parent.LoopBoolEditor.check.Visible = false
script.Parent.LoopBoolEditor.nocheck.Visible = true
s.Looped = false
end)
script.Parent.LoopBoolEditor.closeloopbooleditor.MouseButton1Down:connect(function()
script.Parent.LoopBoolEditor.Visible = false
script.Parent.LoopBool.Visible = true
end)
----------------------------------------------------------------------------------
Output:

19:09:55.255 - can't set value
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 08:33 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 08:52 PM
bump, why doesn't anyone look at this?
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 09:31 PM
bump
Report Abuse
Awsomisticguy537 is not online. Awsomisticguy537
Joined: 03 Dec 2010
Total Posts: 507
22 Jun 2013 09:32 PM
too big. Find the part you need help with and show us that o;
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 10:51 PM
local play = script.Parent.Play
local pause = script.Parent.Pause
local stop = script.Parent.Stop
local playtime = script.Parent.TextLabel
local sec = 00
local minute = 00
local hour = 00
pitchplus = script.Parent.PitchEditor.Plus1
pitchminus = script.Parent.PitchEditor.Minus1
pitch = script.Parent.PitchEditor.Pitch
volumeplus = script.Parent.VolumeEditor.Plus1
volumeminus = script.Parent.VolumeEditor.Minus1
volume = script.Parent.VolumeEditor.Volume

play.MouseButton1Down:connect(function()
local check = game.Soundscape:FindFirstChild("Sound")
if not check then
local id = script.Parent.idholder.Text
s = Instance.new("Sound", game.Soundscape)
s.SoundId = "http://roblox.com/asset/?id="..id
s:Play()
repeat
wait(1)
sec = sec + 1
if sec == 60 then
sec = sec - 60
minute = minute + 1
if minute == 60 then
minute = minute - 60
hour = hour + 1
end
end
playtime.Text = hour..":"..minute..":"..sec
until s:Pause()
else
check.IsPaused = false
repeat
wait(1)
sec = sec + 1
if sec == 60 then
sec = sec - 60
minute = minute + 1
if minute == 60 then
minute = minute - 60
hour = hour + 1
end
end
playtime.Text = hour..":"..minute..":"..sec
until s.Pitch == 0
end
end)
pause.MouseButton1Down:connect(function()
if s then
s:Pause()
end
end)
stop.MouseButton1Down:connect(function()
if s then
s:Stop()
s:Destroy()
s = nil
playtime.Text = "0:0:0"
sec = 00
minute = 00
hour = 00
end
end)
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 11:00 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 11:20 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 Jun 2013 11:37 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 01:18 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 01:32 PM
bump this is the ninth time I've had to bump this thread and barely anyone has replied :(
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 02:22 PM
bump, why does everyone just ignore this...
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 02:33 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 02:53 PM
bump
Report Abuse
jmr11b is not online. jmr11b
Joined: 19 Aug 2010
Total Posts: 806
23 Jun 2013 03:04 PM
The script is very long that is why.
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 05:47 PM
but I need it fixed :(
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