Help with Loading Screen

Hello, fellow devs! I am having a bit of a bug which is probably something to do with the GUI’s size. I created a loading screen with four different events and a random number is picked and that number affects the loading. However, I run into a problem. Not with the scripting, but the size of the bar. Instead of moving directions, it shrinks itself but the rest works fine. The hierarchy is this LocalScript underneath the Bar, the Bar is underneath the BarFrame and the BarFrame is underneath a Frame. This is my first time posting a topic so if I mess up on the category to put it in, please tell me. Thanks!

Here is the code below:

game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):SetTopbarTransparency(1)

local bar = script.Parent.Parent.Bar

local randomNum = math.random(1 , 4)

print(randomNum)

if randomNum == 1 then
	bar:TweenSize(UDim2.new({0, 291},{0, 39}), "InOut", "Linear", 2, true)
	wait(2)
	script.Parent.Parent.Parent.Parent.LoadingFrame.LoadLabel.Text = "Loading complete!"
	wait(3)
	script.Parent.Parent.Parent.Parent.LoadingFrame.Visible = false
end

if randomNum == 2 then
	bar:TweenSize(UDim2.new({0, 148},{0, 39}), "In", "Linear", 3, true)
	wait(2)
	bar:TweenSize(UDim2.new({0, 291},{0, 39}), "In", "Linear", 3, true)
	wait(2)
	script.Parent.Parent.Parent.Parent.LoadingFrame.LoadLabel.Text = "Loading complete!"
	wait(3)
	script.Parent.Parent.Parent.Parent.LoadingFrame.Visible = false
end

if randomNum == 3 then
	bar:TweenSize(UDim2.new({0, 80},{0, 39}), "In", "Linear", 4, true)
	wait(2)
	bar:TweenSize(UDim2.new({0, 148},{0, 39}), "In", "Linear", 4, true)
	wait(2)
	bar:TweenSize(UDim2.new({0, 291},{0, 39}), "In", "Linear", 4, true)
	wait(2)
	script.Parent.Parent.Parent.Parent.LoadingFrame.LoadLabel.Text = "Loading complete!"
	wait(3)
	script.Parent.Parent.Parent.Parent.LoadingFrame.Visible = false
end

if randomNum == 4 then
	bar:TweenSize(UDim2.new({0, 56},{0, 39}), "In", "Linear", 5, true)
	wait(2)
	bar:TweenSize(UDim2.new({0, 148},{0, 39}), "In", "Linear", 5, true)
	wait(5)
	script.Parent.Parent.Parent.Parent.LoadingFrame.LoadLabel.Text = "Loading unsuccessful! Kicking player..."
	wait(2)
	game.Players.LocalPlayer:Kick("Loading failed! Please try again!")
end

I’m confused, did something happen?

Ok. Just making sure it’s nothing important.