When i touch a kill brick, i want it to teleport me to a part, not spawn

So basically when a player touches a kill brick and dies, i want it to teleport them back to a specfic part, and not to the spawn.

KillBrick Script:

function onTouched(part)
 local h = part.Parent:findFirstChild("Humanoid")
 local teleport = workspace.teleport	
 local player = game.Players.LocalPlayer
 if h~=nil then
  h.Health = h.Health-0
  part.Parent.LowerTorso.MoveTo = teleport.Parent:MoveTo()
 end
end
script.Parent.Touched:connect(onTouched)

Error im getting:

image

Instead of killing them you can just teleport them to where you want to go.

If you know the position you want to move them

Character:MoveTo(Vector3.new(0, 0, 0))

Or you can move them to a part in workspace

 Character:MoveTo(Vector3.new(workspace.Part.Position))
1 Like

24 posts were moved out for being off-topic and inappropriate.

Please make sure you’re familiar with the forum rules

As far as I’m aware, BaseParts don’t have a MoveTo() function. Models do, though.
Instead of what you have on line 7, you should opt to do this instead:

part.Parent:MoveTo(TeleportPart.Position)

Otherwise you could do this instead:

part.Parent.HumanoidRootPart.CFrame = TeleportPart.CFrame
1 Like

Locked due to excessive inappropriate replies.