UserId returns nil or -1

So I have been working a system in a story game where if there is one player in the server, it will appear one npc of their avatar, and if there is two players there will have 2 npc and each of the avatar will be either on any of the dummies. I made a print statement to display the player or players ids, this system works perfectly when I play the game with 1 player, but if I make a 2 players test server, the UserIds output will either display nil or -1. Can someone please tell me what I have done wrong? I tried everything I could but I could not stop this problem.

The first npc

The second npc

Hey! There’s nothing wrong with your script. When you are testing with 2+ in roblox studio, the userIDs will be in negatives.

oh, lets say if I want to test it out with 2 players. How I achieve this?

You would want to disable your :ApplyDescription line, or test it with an alt account.

ok thanks for your help!

a;lsdkfja;sdlkfja;sdlkf (30)

image

p.s. NumPlayers is outdated. Use #game.Players:GetPlayers() instead