So I have made a loading circle. It is a basic decal. What I want it to do, is when the GUI is enabled, the loading circle starts and goes for about 5 seconds. and then it fades into some text. The problem is, after about 1 second, it just stops. And it does not fade into text at all. Can you guys help me?
Script:
local Background = script.Parent.Parent
script.Parent.Background.TextButton.MouseButton1Click:Connect(function()
local gui = Background:FindFirstAncestorOfClass("ScreenGui")
gui:Destroy()
end)
while wait() do
game.TweenService:Create(script.Parent.Background.ImageLabel,TweenInfo.new(1.5,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{Rotation=500}):Play()
wait(1)
while wait() do
script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency + 0.08
script.Parent.Parent.BarBackground.BackgroundTransparency = script.Parent.Parent.BarBackground.BackgroundTransparency + 0.08
script.Parent.Parent.LoadingText.TextTransparency = script.Parent.Parent.LoadingText.TextTransparency + 0.08
if script.Parent.BackgroundTransparency >= 1 then
script.Parent.Parent.AfterText.Visible = true
wait(1)
script.Parent.Parent.Done.Visible = true
script.Parent.Parent.TextButton.Visible = true
end
end
end
What I meant is the code will keep on going and wont wait for the tween to finish like this:
game.TweenService:Create(script.Parent.Background.ImageLabel,TweenInfo.new(1.5,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{Rotation=500}):Play()
print("Ok")
-- It will print ok even if the image didnt rotate completely.
You could make the Tween into a variable, play it, then wait for the .Completed event to fire.
local tween = game.TweenService:Create(script.Parent.Background.ImageLabel,TweenInfo.new(1.5,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{Rotation=500})
tween:Play()
tween.Completed:Wait()
-- rest of code
Hey so I am trying to get the stuff to fade but I keep getting an error saying “ImageLabel is not a valid member of ImageLabel.” Can you tell me why?
local tween = game.TweenService:Create(script.Parent.Background.ImageLabel,TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{Rotation=500})
tween:Play()
tween.Completed:Wait(1)
while wait do
script.Parent.Background.ImageLabel = script.Parent.Background.ImageLabel.ImageTransparency + 0.08
script.Parent.Parent.LoadingText.TextTransparency = script.Parent.Parent.LoadingText.TextTransparency + 0.08
if script.Parent.BackgroundTransparency >= 1 then
script.Parent.Parent.AfterText.Visible = true
wait(1)
script.Parent.Parent.Done.Visible = true
script.Parent.Parent.TextButton.Visible = true
end
end
```