pacmastermeow
Member
Lua:
addHook("PlayerSpawn", function()
for player in players.iterate do
chatprint(#player)
chatprint(followers[#player].name)
chatprint(player.follower.name)
chatprint("----")
end
end)
When I run the mod that this code is in, I get "attempt to index field 'follower' (a nil value)" on the line with
chatprint(player.follower.name), and chatprint(followers[#player].name) just prints a pre-defined list of 16 followers no matter who has what (the first 16 followers that were added to the game?)I suspect the "nil value" result has to do with the follower entity not being loaded in yet. What would the solution/workaround be to detect what follower each player chose?