I'm trying to give a badge when the NPC dies but it says that the UserID is not a valid member of the player. How could I fix this? I'd appreciate anyone who can help me.
local Players = game:GetService("Players") local Bird = script.Parent:WaitForChild("Humanoid") local BadgeService = game:GetService("BadgeService") local BadgeID = 0 --I haven't made a badge yet while wait() do if Bird.Died then for i, player in pairs(game.Players:GetPlayers()) do BadgeService:AwardBadge(player.UserID, BadgeID) print("Badge has been given.") end end end
So this is a simple mistake that a lot of new coders make (including me when I was new), and the error is that you have to do player.UserId
, not player.UserID
.