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

Is there a way to...?

Asked by 10 years ago

Is there a way to get this script of mine not to freeze up my computer when I try to run it?

Amount = 5 -- How many will be made.
Fade = false -- Will it/they fade?
Fade_Time = 5 -- How long will it take for it/them to fade.
instance = "StockSound" -- The instance being made.
parent = game -- Where the instance will end up.
Time_Taken = 1 -- The Time it takes for a/each instance to be made.
IDs = false -- Will there be IDs?

--[[ Do not mess with the code below unless you know what you are doing! ]]--

local Holder = Instance.new("Model", parent) Holder.Name = "Holder"

local Total = 0

repeat
if IDs then
Total = Total + 1
local thing = Instance.new(instance, Holder)
thing.Name = instance .. " " .. Total .. " out of " .. Amount
wait(Time_Taken / 1/2)
if Fade then
    game:GetService("Debris"):AddItem(thing, Fade_Time)
    game:GetService("Debris"):AddItem(Holder, Fade_Time * Amount / 1/2)
    wait(Time_Taken / 1/2)
elseif IDs and Fade == false then
    wait(Time_Taken / 1/2)
if IDs == false then
Total = Total + 1
local thing = Instance.new(instance, Holder)
thing.Name = instance
wait(Time_Taken / 1/2)
if Fade then
    game:GetService("Debris"):AddItem(thing, Fade_Time)
    game:GetService("Debris"):AddItem(Holder, Fade_Time * Amount / 1/2)
    wait(Time_Taken / 1/2)
else
    wait(Time_Taken / 1/2)
end
end
end
end
until
Total == Amount
  • it is meant to generate instances with the in-script settings!

1 answer

Log in to vote
2
Answered by
LAC44 20
10 years ago

Its because you didn't add a wait time after "repeat" which makes it an infinite loop that has no wait time.

This should fix your script:

Amount = 5 -- How many will be made.
Fade = false -- Will it/they fade?
Fade_Time = 5 -- How long will it take for it/them to fade.
instance = "StockSound" -- The instance being made.
parent = game -- Where the instance will end up.
Time_Taken = 1 -- The Time it takes for a/each instance to be made.
IDs = false -- Will there be IDs?

--[[ Do not mess with the code below unless you know what you are doing! ]]--

local Holder = Instance.new("Model", parent) Holder.Name = "Holder"

local Total = 0

repeat
wait(1) --change to the time you want to wait after every loop.
if IDs then
Total = Total + 1
local thing = Instance.new(instance, Holder)
thing.Name = instance .. " " .. Total .. " out of " .. Amount
wait(Time_Taken / 1/2)
if Fade then
    game:GetService("Debris"):AddItem(thing, Fade_Time)
    game:GetService("Debris"):AddItem(Holder, Fade_Time * Amount / 1/2)
    wait(Time_Taken / 1/2)
elseif IDs and Fade == false then
    wait(Time_Taken / 1/2)
if IDs == false then
Total = Total + 1
local thing = Instance.new(instance, Holder)
thing.Name = instance
wait(Time_Taken / 1/2)
if Fade then
    game:GetService("Debris"):AddItem(thing, Fade_Time)
    game:GetService("Debris"):AddItem(Holder, Fade_Time * Amount / 1/2)
    wait(Time_Taken / 1/2)
else
    wait(Time_Taken / 1/2)
end
end
end
end
until
Total == Amount
Ad

Answer this question