Is it possible to make this script pause the script when you click on an object and when you click again it runs ?
movie = script.Parent while true do wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=947990366" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=999441417" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=999062545" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=992753392" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=997539915" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=1079978330" wait (0) end
local images = { "947990366", "999441417", "999062545", "992753392", "997539915", "1079978330" } local stopped = false local pic = movie:WaitForChild("picy") local button = script.Parent:WaitForChild("ClickDetector") local theLoop= coroutine.wrap(function() while true do for i = 1,#images do pic.Texture = "http://www.roblox.com/asset/?version=1&id="..images[i] wait(10) end end end) button.MouseClick:Connect(function(player) if stopped == false then stopped = true theLoop.yield() else stopped = false theLoop.resume() end end) theLoop()
What I did here was add a BoolValue and set it to true, and added an if then statement that checks the value of that BoolValue. As you can see, if the value is true, the script will break, which ends the loop. You can change it around as you want, but yeah, this might be what you want!
movie = script.Parent value = Instance.new("BoolValue") value.Parent = game.ReplicatedStorage value.Name = "Test" value.Value = true while true do wait() if game.ReplicatedStorage.Test.Value == false then wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=947990366" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=999441417" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=999062545" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=992753392" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=997539915" wait(10) movie.picy.Texture = "http://www.roblox.com/asset/?version=1&id=1079978330" wait (0) else break end end