Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make your Character Teleport when killing a NPC?

Asked by 4 years ago

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

Answer this question