Using --!strict
:
Warning shown that type is of Instance
instead of Player
.
Expected behavior
team:GetPlayer()
should give me type {Player}
(or something to that effect)
Using --!strict
:
Warning shown that type is of Instance
instead of Player
.
Expected behavior
team:GetPlayer()
should give me type {Player}
(or something to that effect)
Thanks for the report! We’ll follow up when we have an update for you!
Hey, sorry for bumping a dead thread, but this is still a thing!
Team:GetPlayers()
returns an array of objects of type Instance
, when you’d expect them to be Player
.
This doesn’t happen in a similar method in game.Players:GetPlayers()
This results in some funky behavior in strict typing where the type checker will complain about one thing but not the other:
just as some info, for anyone who wants a workaround, you can explicitely cast to {Player}
to get rid of this warning without disabling strict mode.
for _, player in game:GetService("Teams").Team:GetPlayers() :: {Player} do
print(player.UserId)
end
damn, i’ve been assigning a separate variable like:
local PLEASETHISISAPLAYER = v :: Player