I am testing a loading screen for a simulator I’m making. It isn’t working, and I’m getting an error that says: ReplicatedFirst.LoadingScreen:14: Expected ')' (to close '(' at column 51), got '='
Here’s the script:
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local localplr = game:GetService("Players").LocalPlayer
local gui = script.LoadingScreen:Clone()
local loadingMessage = {"test1,test2"}
local randomValue = loadingMessage[math.random(1,#loadingMessage)]
local seconds = 0
gui.Parent = PlayerGui
ReplicatedFirst:RemoveDefaultLoadingScreen()
repeat
if randomValue == "test1" then
gui.MainFrame.Status.Text = randomValue.."? ("..(seconds = seconds + 1)..")"
wait(1)
gui.MainFrame.Status.Text = randomValue.."?? ("..(seconds = seconds + 1)..")"
wait(1)
gui.MainFrame.Status.Text = randomValue.."??? ("..(seconds = seconds + 1)..")"
wait(1)
elseif randomValue == "test2" then
gui.MainFrame.Status.Text = randomValue..". ("..(seconds = seconds + 1)..")"
wait(1)
gui.MainFrame.Status.Text = randomValue..".. ("..(seconds = seconds + 1)..")"
wait(1)
gui.MainFrame.Status.Text = randomValue.."... ("..(seconds = seconds + 1)..")"
wait(1)
end
until game:IsLoaded()
wait(1)
gui.MainFrame:TweenPosition(UDim2.new(0,0,1,0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,0.5,false)
wait(1)
gui:Destroy()
PlayerGui:WaitForChild("Intro"):WaitForChild("MainFrame"):TweenPosition(UDim2.new(0.5,0,0.5,0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,0.5,false)```
If I need any more information than this, please point that out to me.
You can’t have two assignment operators (=) in a statement. Also, there’s an easier way to do this than just repeating yourself. This is what it should like like in the repeat loop.
You’re not reassigning the value ‘seconds’ as shown by @Kacper, you need to redefine the value after making changes. I would suggest you just use the code they shared.