Hello!
I was recently trying to figure out a way of teleporting an NPC model that has a humanoid inside, to a CFrame of another part. I was unsuccessful finding resources on how to do this.as the primary part of the model is the humanoid, but the humanoid has no CFrame value to change.
Here is how my script works:
I clone an NPC model from ReplicatedStorage and set it’s parent to a house model in the workspace.
I then try to teleport that model to a part named “PointA” using PointA’s CFrame.
Here is the script:
if taken == false then
DoorBellClick.MaxActivationDistance = 0
taken = true
DoorBellSFX:Play()
wait(2.5)
DoorOpenSFX:Play()
wait(1)
DoorSwingTween:Play()
local NPC = NPCs[math.random(1, #NPCs)] --Choses Random NPC from NPCs Folder
print("NPC Chosen: "..NPC.Name)
NPC:Clone() --Clones randomly selected NPC
NPC.Parent = script.Parent --Puts randomly selected NPC into the house model, where this script is housed
local NPCHumanoid = NPC.Humanoid --|
NPCHumanoid.CFrame = PointA.CFrame --This is where the error is, I have no idea on how to teleport that NPC model's CFrame to the PartA's CFrame
--rest of script
end
Here is also a visual:
(Ignore PointB as its purpose is in the rest of the script)
Does anyone have any ideas on how I can perform this?