0

# How to make your Character Teleport when killing a NPC?

So I'm pretty new to scripting and I wondered how I could make your character teleport to a position when you kill a NPC.

I get the error attempt to index nil with 'Character' , and I've tried researching but I simply can't find a solution on how to let the script find the HumanoidRootPart

local player = game.Players.LocalPlayer
local char = player.Character

if script.Parent.Human.Health <= 0 then
char.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 50, 0))
end