Help! The identifier "Player" isnt a valid type (not a scipt or class), or couldnt be found on base "self"

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mattryan26

class_name PlayerState
extends State

Typed reference to the player node.

var player: Player

func _ready() → void:
# The states are children of the Player node so their _ready() callback will execute first.
# That’s why we wait for the owner to be ready first.
yield(owner, “ready”)
# The as keyword casts the owner variable to the Player type.
# If the owner is not a Player, we’ll get null.
player = owner as Player
# This check will tell us if we inadvertently assign a derived state script
# in a scene other than Player.tscn, which would be unintended. This can
# help prevent some bugs that are difficult to understand.
assert(player != null)

:bust_in_silhouette: Reply From: Inces
var player: Player

only this line throws the error. Player is not recognized as a class You created. You are supposed to introduce this class in Players script, using class_name Player