For some reason theres red underline under the tables and they werent there before so im confused
Were these variables declared earlier? Is this inside of the scope of a function?
Well I have them just outside of everything and they werent underline before, I just restarted my studio and now this is happening
What does it say when you hover over it?
You must be missing a } prior in the script
Does changing them into local variables remove this red line?
local Stopped = {}
local Turned = {}
Along with other tables in the global scope of the script?
There should be no need to add local to a global variable.
It happens sometimes when you don’t put “local”. I’m pretty sure it will run fine even without “local”
No need, but it’s better practice. You can access it faster, and it cleans up your code. Because sometimes you would have 2 variables named different things and in 2 different scopes, and having a global variable would cause problems.
I cannot find a meaning of using global variables, there is always a way to make everything local. It’s not just faster, but cleaner like I stated.
@loveicicIe It’s not a red underline, it’s orange actually, orange is a warning that you shouldn’t do this(it’s still going to work), red means that it will not work.
Yeah it breaks my table debounces
No, forgetting to add a closing bracket will only cause an error to appear on the line below the open table.
i.e:
local tbl = {1,2,3
local val = 1 -- Only this has an error indicator.
local val2 = 2
And to answer to your point, occasionally when opening and re-opening a script roblox neglects to indentify the scope as the script source itself, thus identifying global variables as local variables causing the red line.
Can you share lines 1-8? The error might be up there.
math.randomseed(os.time())
local CS = game:GetService("CollectionService")
local Cars = CS:GetTagged("Carz")
local Tween = require(game.ReplicatedStorage.UITween)
local stopSigns = game.Workspace.StopSigns
Stopped = {}
Turned = {}
IntersectionRotations = {
math.rad(90);
math.rad(-90);
0
}
CarDistances = {
["Bus"] = 20;
["Mustang"] = 25;
["Pickup"] = 25;
["Taxi"] = 14.5;
["Truck2"] = 25;
}
I pasted this into studio and do not receive any warning/error indicators, if this isn’t disrupting your code at all I would say just ignore it as it seems to be a roblox-sided display issue more than anything else.
It is disrupting my code its breaking all of my debounces that I use
Doesn’t show up on mine. It might be just a small glitch and judging by the error I believe it thinks that you never closed line 9 with the ending }. Does the error still show up if you copy and paste this into a new script, or at least copy and paste the code back into the same script?
Then I guarantee it is a matter of your debounces being broken as opposed to this warning indicator causing any deeply rooted issues.
Perhaps supplying your debounce code (which shouldn’t be dependent on this style of dictionary in the first place) could lead to a solution being reached.
I made a completely new script and its still not working
When you hover over it does it give you a similar error to the one you sent before?