Syntax
Your error is a syntax error -- what you've written doesn't mean anything because it doesn't make sense to the computer.
It's telling you that it expects ( near = on line 3. In other words, it expected something like
function LoadBar(
but you gave it
function LoadBar =
That isn't valid Lua. Function definitions (normally) need to have names:
LoadBar = game.StarterGui.LoadingScreen.FrameMain.Bar.AbsoluteSize
function moveLoadingBar()
LoadBar = "154,0"
wait(2)
LoadBar = "340,0"
wait(1)
LoadBar = "677,0"
wait(1)
LoadBar = "964,0"
wait(5)
LoadBar = "1000,0"
wait(3)
LoadBar = "1473,0"
end
You don't call this function, so it will never happen. There's not really even a point to the function in that case.
Read Only
AbsoluteSize is read only:
This property can only be read from. Attempting to write to it will cause an error.
If you want to change the size, change the .Size property.
Types
Size (or AbsoluteSize for that matter) is not text. "340,0" does not describe a size, it describes a chunk of text.
You need to make the object of the right type. You can check what type is needed in the Wiki or Object browser.
For example,
[AbsoluteSize] Value Type: Vector2
\
[Size] Value Type: UDim2
If you click the link UDim2 you can see the list of constructors -- how to construct a UDim2.
You want UDim2.new(0, 340, 0, 0).
Assignments
When you define LoadBar in the first line, that just sets LoadBar to the current AbsoluteSize.
It does not "link" LoadBar to the absolute size of loadbar.
If you want to change a property, you have to do it explicitly.
local bar = game.StarterGui.LoadingScreen.FrameMain.Bar
bar.Size = UDim2.new(0, 154, 0, 0)
wait(2)
bar.Size = UDim2.new(0, 340, 0, 0)
wait(1)
....
2 comments
This isn't even close to right. Almost every detail has a mistake.
Could you possibly correct it? Just telling me I am wrong wouldn't help. Thanks for the feedback though.