It only makes sense that utilizing FindFirstChild on Players should always return Player? as it is always guaranteed that the returned instance is gonna be Player or nil hence the ?, removing the need for local Player: Player? = Players:FindFirstChild(Player.Name) type check.
This is not correct, the Instances are not restricted within the Players service:

I think this is the same reason Players:GetPlayers exists as a very similar alternative to Players:GetChildren, one is actually guaranteed to return a Player instance, and the other is not. Maybe the more sound (type-safe) thing to do is to add a Players:FindPlayer method, I don’t know.
That’s why I said Player? instead of Player, it COULD BE Player. But you’re about needing a FindPlayer method.
Player? still assumes it can ONLY ever be a Player instance though, which is incorrect and would be incredibly misleading to any developers who are unaware that non Player instances can exist inside of Players.
I think it should be BasePart? because it could be a basepart
Another solution to determine that it should be player is this.
(function(SpeakingPlayer: Player)
-- Player?
local Player = Players:FindFirstChild(SpeakingPlayer.Name)
end)(SpeakingPlayer)
if i understood this post
this is basically if FindFirstChild would assuming it’s Player but still will returned the correct instance from (if) Players, i guess
This isn’t true, so it can’t be a part of the contract.
You should instead assert(player ~= nil and player:IsA("Player"), "Non-player in Players, or nil") after fetching it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.