for i=0, 1080, 1 do
script.Parent.Frame.Position = script.Parent.Frame.Position - UDim2.new(0, 0, 0.005, 0)
wait(0.1)
end
script.Parent.ImageLabel2.BackgroundTransparency="0.1"
script.Parent.ImageLabel2.ImageTransparency="0.55"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="0.2"
script.Parent.ImageLabel2.ImageTransparency="0.6"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="0.3"
script.Parent.ImageLabel2.ImageTransparency="0.65"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="0.4"
script.Parent.ImageLabel2.ImageTransparency="0.7"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="0.5"
script.Parent.ImageLabel2.ImageTransparency="0.75"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="0.6"
script.Parent.ImageLabel2.ImageTransparency="0.8"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="0.7"
script.Parent.ImageLabel2.ImageTransparency="0.85"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="0.8"
script.Parent.ImageLabel2.ImageTransparency="0.9"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="0.9"
script.Parent.ImageLabel2.ImageTransparency="0.95"
wait(0.1)
script.Parent.ImageLabel2.BackgroundTransparency="1"
script.Parent.ImageLabel2.ImageTransparency="1"
for i=0, 1, 0.05 do
script.Parent.Parent.End.Volume = script.Parent.Parent.End.Volume - i
wait(0.1)
end
script.Parent.Parent.End:Pause()
wait(0.2)
script.Parent:Destroy()
✓ ANSWER ACCEPTED
Make this script more efficient?
2 answers
✓ Accepted answer
for i=0, 1080, 1 do
script.Parent.Frame.Position = script.Parent.Frame.Position - UDim2.new(0, 0, 0.005, 0)
wait(0.1)
end
function lowerBackgroundTransparency()
for b = 0, 1, 0.1 do
script.Parent.BackgroundTransparency = b
wait(0.1)
end
end
function lowerImageTransparency()
for i = 0.5, 1, 0.05 do
script.Parent.ImageTransparency = i
wait(0.1)
end
end
Spawn(lowerBackgroundTransparency) -- Spawns this function
Spawn(lowerImageTransparency) -- Spawns this function
-- Might want to put a check here so it waits until they are both done.
for i=0, 1, 0.05 do
script.Parent.Parent.End.Volume = script.Parent.Parent.End.Volume - i
wait(0.1)
end
script.Parent.Parent.End:Pause()
wait(0.2)
script.Parent:Destroy()
The best way I can think about to make this work would be by using Threading to make the loops run at the same time:
for i=0, 1080, 1 do
script.Parent.Frame.Position = script.Parent.Frame.Position - UDim2.new(0, 0, 0.005, 0)
wait(0.1)
end
function lowerBackgroundTransparency()
for b = 0, 1, 0.1 do
script.Parent.BackgroundTransparency = b
wait(0.1)
end
end
function lowerImageTransparency()
for i = 0.5, 1, 0.05 do
script.Parent.ImageTransparency = i
wait(0.1)
end
end
Spawn(lowerBackgroundTransparency) -- Spawns this function
Spawn(lowerImageTransparency) -- Spawns this function
-- Might want to put a check here so it waits until they are both done.
for i=0, 1, 0.05 do
script.Parent.Parent.End.Volume = script.Parent.Parent.End.Volume - i
wait(0.1)
end
script.Parent.Parent.End:Pause()
wait(0.2)
script.Parent:Destroy()
This discussion is preserved as it was. New answers, comments, and votes are closed.
