Random orange bar

so i was just coding and randomly, i got this orange bar at the top of every script??? i tried reopening studio but its still there…

it doesn’t tell me anything even when i try overing over it
image

even in a blank script
image

is it just me?

how do i fix because its ruining the type check

3 Likes

Restart studio

thanks… i tried that but i did it again by using the task manager and it worked

hey…uhh its back again, what do i do

1 Like

This should help

It is the Luau type checker throwing a type inference error.

I know you’ve been messing around with this stuff, and you made a mistake that the type checker is having problems with.

You could try ..

–!nocheck
or
–!nonstrict
or
File > Beta Features > disable “New Luau Type Solver” > restart Studio.
or
Find that sketchy script part and remove it.

i was working on this code and when i finished adding the bottom function, it caused the orange bar:

--!strict

local module = {}

local abilities = {
	["Ring"] = {
		ZMove = true,
		XMove = false,
		CMove = false,
		SpecialMove = true,

		MovesData = {
			ZMove = {
				Name = "Tornado",
				Cooldown = 12,
				Hitbox = "WindRingZHitbox",
				Duration = 1.2,
				Resistance = 10,
				Knockback = 30,
				StunDuration = 1.4,
				Stun = true,
				Hotkey = "Z",

				BackgroundColor = Color3.fromRGB(77, 77, 77),
				TextColor = Color3.fromRGB(255, 255, 255),
				StrokeColor = Color3.fromRGB(0, 0, 0),
				KeyColor = Color3.fromRGB(255, 255, 255),
				KeyStrokeColor = Color3.fromRGB(0, 0, 0),

				Data = {
					DashTime = 1.02,
					ForwardSpeed = 60,
					DriftSpeed = 28,
				},
			},
			SpecialMove = {
				Name = "Wind Arrow",
				Cooldown = 15,
				Hitbox = "WindRingRHitbox",
				Duration = 1,
				Resistance = 40,
				Knockback = 50,
				StunDuration = 1.6,
				Stun = true,
				Hotkey = "R",

				BackgroundColor = Color3.fromRGB(186, 186, 186),
				TextColor = Color3.fromRGB(255, 255, 255),
				StrokeColor = Color3.fromRGB(139, 139, 139),
				KeyColor = Color3.fromRGB(186, 186, 186),
				KeyStrokeColor = Color3.fromRGB(139, 139, 139),
			},
		},
	},
}

export type Ability = {
	ZMove: boolean?,
	XMove: boolean?,
	CMove: boolean?,
	SpecialMove: boolean?,

	MovesData: {
		ZMove: MoveData,
		XMove: MoveData,
		CMove: MoveData,
		SpecialMove: MoveData,
		[string]: MoveData
	},
	
	HotkeyMoves: {
		[string]: MoveData
	}
}

export type AbilityName = keyof<typeof(abilities)>

export type Abilities = {
	[string | AbilityName]: Ability
}

export type MoveData = {
	Name: string,
	Cooldown: number,
	Hitbox: string,
	Duration: number,
	Resistance: number,
	Knockback: number,
	Hotkey: string,
	
	BackgroundColor: Color3,
	TextColor: Color3,
	StrokeColor: Color3,
	KeyColor: Color3,
	KeyStrokeColor: Color3,
	
	Data: {any}?,
} & {
	Stun: true,
	StunDuration: number
}

for name, abilityData in abilities :: Abilities do
	abilityData.HotkeyMoves = {}
	
	for move, moveData in abilityData.MovesData do
		abilityData.HotkeyMoves[moveData.Hotkey] = moveData
	end
end

export type GetAbility<T> = index<typeof(abilities), T>

function module.GetAbilityData<T>(name: T | AbilityName): GetAbility<T>
	return abilities[name]
end

return module

This happened to me too, left me pulling my hair out trying to fix it.
These are hard to understand, as it may be a bug in the type solver.

Taking a guess here, maybe this will remove that bar.
This..

export type GetAbility<T> = index<typeof(abilities), T>
function module.GetAbilityData<T>(name: T | AbilityName): GetAbility<T>
	return abilities[name]
end

For this

function module.GetAbilityData(name: AbilityName): Ability?
    return abilities[name]
end

Trying to simplify here, but this is more of a workaround, if it even works.

This is still in Beta Features in Roblox Studio, which is exactly why it has these kinds of bugs. It is not a totally stable type checker yet.

Is it working as is? .. you may want to try the –!nocheck or –!nonstrict option.

is there any way i could use abilityName inbetween the <> so i don’t have to rewrite it?

local abilityName: Abilities.AbilityName = "Ring"

local abilityData = Abilities.GetAbilityData(abilityName) :: Abilities.GetAbility<"Ring">

this is what my ability moduel looks like:

export type GetAbility<T> = index<typeof(abilities), T>

function module.GetAbilityData(name: string | AbilityName): Ability?
	return abilities[name]
end

i think the you were right about the function causing it

Options are either hardcode the string literal like you’re doing now:

local abilityData = Abilities.GetAbilityData(abilityName) :: Abilities.GetAbility<"Ring">

Or cast to Ability? and skip the generic entirely:

local abilityData = Abilities.GetAbilityData(abilityName) :: Abilities.Ability?

The second option is cleaner since GetAbilityData now returns Ability? anyways.
In fact the cast to Ability? is even a bit pointless since the function already returns Ability?
You could just do..

local abilityData = Abilities.GetAbilityData(abilityName)

I honestly hate speculating on things I can’t work with myself. And I’m not touching this.. you’re way too hardcore for me. Can we go back to bananas and oranges? :face_with_crossed_out_eyes:

o, im not good either… i just started learning these things 3 days ago and i wanted to try to use it.

well, i decided to just not use the function and to just do:
Abilities["Ring"]

…cleaned up the scripts that used the function and now its way better now !

whenever the ‘const’ keyword gets added, i think these types might work. im not sure if the keyword is what i think it would do but i think its like a ‘local’ variable but its unable to be changed

1 Like