Hello,
I have a problem with my loading screen, it’s “glitched” : https://gyazo.com/7edee6eb7ae60afdfe0d0a402dfaa609
local Tween = game:GetService("TweenService")
local info = TweenInfo.new(0.5)
local bar = script.Parent.Bar
local startBar = script.Parent.StartBar
local endBar = script.Parent.EndBar
local goal = {}
goal.Size = endBar.Size
goal.Position = endBar.Position
local goalBack = {}
goalBack.Size = startBar.Size
goalBack.Position = startBar.Position
local anim = Tween:Create(bar, info, goal)
local animBack = Tween:Create(bar, info, goalBack)
game:GetService("RunService").Stepped:Connect(function()
if not script.Parent.Value.Value then
anim:Play()
task.wait(info.Time)
animBack:Play()
task.wait(info.Time)
else
anim:Cancel()
animBack:Cancel()
end
end)

Try replace info.Time with 0.5
I found the problem. It because of the Stepped:Connect
Use while game.RunService.Stepped:Wait() do end instead of game.RunService.Stepped:Connect the problem should be fixed
Just, I add the code between “do” and “end” so?
Try this
local Tween = game:GetService("TweenService")
local info = TweenInfo.new(0.5)
local bar = script.Parent.Bar
local startBar = script.Parent.StartBar
local endBar = script.Parent.EndBar
local goal = {}
goal.Size = endBar.Size
goal.Position = endBar.Position
local goalBack = {}
goalBack.Size = startBar.Size
goalBack.Position = startBar.Position
local anim = Tween:Create(bar, info, goal)
local animBack = Tween:Create(bar, info, goalBack)
task.spawn(function()
while true do
game:GetService("RunService").Stepped:Wait()
if not script.Parent.Value.Value then
anim:Play()
task.wait(info.Time)
animBack:Play()
task.wait(info.Time)
else
anim:Cancel()
animBack:Cancel()
end
end
end)
1 Like
Oh yeah thanks it works !

1 Like