Attempt to call missing method '' of table

I’m making a script where an NPC copies a random player’s avatar, but whenever i run this script, it returns an error saying ‘Workspace.mimic.Script:7: attempt to call missing method ‘GetHumanoidDescriptionFromUserId’ of table’

local players = game:GetService("Players"):GetPlayers()
local playerss = game:GetService("Players")
local rig = script.Parent
local humanoid = rig:WaitForChild("Humanoid")
local pickedPlayer = players[math.random(1, #players)]

local desc = players:GetHumanoidDescriptionFromUserId(pickedPlayer.UserId)
humanoid:ApplyDescription(desc)

wait(10)

script.Parent:Destroy()
1 Like

You defined players as an array of Players.

1 Like

As the above post said, you are using players, which is an array of the players currently in game, and attempting to call a function from it, which errors.

Try replacing players with playerss. This will ensure that it is accessing the service for players, which you have previously defined as playerss

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.