I want to spawn an NPC with a players appearance but I keep getting this error;
Unable to cast token to token - Server - getCharacterAppearance:9
I am using a module script, so I have to require the module.
Here is my script for the module;
local getCharacterAppearance = {}
function getCharacterAppearance.copy(player:Player)
local npc = game.ReplicatedStorage:FindFirstChild("ThePlayer"):Clone()
local npcHum = npc:FindFirstChildOfClass("Humanoid")
local playerHumDesc = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
npcHum:ApplyDescription(playerHumDesc, Enum.HumanoidRigType.R6)
local npcHead = npc.Head
local npcName = npcHead.Overhead
npcName.Username.Text = player.Name
return npc
end
return getCharacterAppearance
The way I am requiring it does not seem to have any issues, if anyone sees an issue within my code please let me know.
Yes, but I already cover that after the script is required
This is a function from my other module;
function doorModule.youarenotyou(player, char, root)
local npc = getCharacterAppearance.copy(player)
npc.Parent = game.Workspace.NPCS
npc.Humanoid:MoveTo(Vector3.new(-1.029, 3, -199.5))
npc.Humanoid.MoveToFinished:Wait()
Chat:Chat(npc.Head, "you are not you")
end