Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Can you pause scripts?

Asked by
iAviate 20
9 years ago

Right - I made this long script that basically plays audio end on end, switching songs when on ends. I want to create a screenGUI that, when you click it, pauses the whole thing, and that when you click play, it continues where it left off. Is it possible to pause a script while it's running?

1 answer

Log in to vote
0
Answered by
Voltoxus 248 Moderation Voter
9 years ago
-- Try this,  I don't know were your Script is located or were the sound is being stored so adjust --accordingly
SoundObj = Put the sound Location here.

function Toggle()
if game.Workspace["Script Name here"].Disabled ==true then
game.Workspace["Script Name here"].Disabled = false
SoundObj:stop()
elsedo
game.Workspace["Script Name here"].Disabled = true
soundObj:Play()
end
end

--Assuming you will put this in to a button
script.Parent.MouseButton1Down:connect(Toggle)

0
There's no actual 'Sound' to link to. My script creates new Sound instances, and changes the asset id iAviate 20 — 9y
0
Do you know how to script? Voltoxus 248 — 9y
0
Coming back to this - a year later - this was actually quite useful. Thanks. iAviate 20 — 8y
0
lol Voltoxus 248 — 8y
Ad

Answer this question