#create a npc with a player skin

1 messages · Page 1 of 1 (latest)

fiery yacht
#

Okay so i want to create a npc, i have the basic rig in serverscriptservice and i want to create it then add a players skin on to it but right now, the body doesnt even spawn anymore

while true do
    if Spawned == false then
        task.wait(1)
        local player = Players:GetPlayerByUserId(1641989288)
        if player then
            Spawned = true
            local character = player.Character or player.CharacterAdded:Wait()

            local newNPC = ServerScriptService.NpcTemplate:Clone()
            newNPC.Parent = Workspace
            
            local humanoid = newNPC:FindFirstChildOfClass("Humanoid")
            if humanoid then
                if not humanoid:FindFirstChildOfClass("Animator") then
                    Instance.new("Animator", humanoid)
                end
            end
                
            local hrp = newNPC:FindFirstChild("HumanoidRootPart")
            if hrp then
                hrp.CFrame = SpawnPart.CFrame + Vector3.new(0, 0, 0)
                task.spawn(function()
                    MoveToTarget(newNPC, EndPart)
                end)
            end
            task.wait(SpawnInterval)
        else
            warn("Player nil")
        end
    else
        task.wait()
    end
end```
crude torrent
fiery yacht
#

i dont mind how i do it

crude torrent
#

i'd suggest you look at forums

fiery yacht
#

i want a npc that spawns a user

crude torrent
crude torrent
fiery yacht
#

like in them resturant games

#

sort of that i guess

crude torrent
#

oh those

#

idk how you do them when a player is offline but what u can do is

fiery yacht
#

i found this, im gonna try it

local Description = game.Players:GetHumanoidDescriptionFromUserId(39939779)
local Dummy = workspace:WaitForChild("Dummy")

Dummy.Humanoid:ApplyDescription(Description)```
crude torrent
#

if it doesnt work, just make a folder full of npcs and make so that a random one gets chosen and basically gets cloned

#

and then u can animate it and add pathfinding etc

#

@fiery yacht

fiery yacht
crude torrent
#

yea just look up how to get a players model from their id or smth

fiery yacht
#

it works

#

@crude torrent

#

i got a question

crude torrent
fiery yacht
# crude torrent go on

so this is my script, but i see the npc dummy for like a second before its moved and character set, how would i fix this?

while true do
    if Spawned == false then
        Spawned = true
            
        local Dummy = NpcTemplate:Clone()
        Dummy.Parent = Workspace
        
        local Description = game.Players:GetHumanoidDescriptionFromUserId(1641989288)
        Dummy.Humanoid:ApplyDescription(Description)
        
        local hrp = Dummy:WaitForChild("HumanoidRootPart")
        hrp.CFrame = SpawnPart.CFrame + Vector3.new(0, 5, 0)

        task.spawn(function()
            MoveToTarget(Dummy, EndPart)
        end)
        
        task.wait(SpawnInterval)
    else
        task.wait(.05)
    end
end```
crude torrent