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

How to teleport an entire character instead of one part of your character?

Asked by
LazokkYT 117
3 years ago
Edited 3 years ago

Hey guys,

I'm trying to make a white frame to cover your screen, and then, the script will teleport you to a part.

Teleporting works, but it only teleports one part of your body (HumanoidRootPart, Head, Left leg, etc.) and it glitches out. So, is there any way I can teleport the entire body without having to write many lines of code?

By the way, here is the teleporting code that glitches you out:

game.Players.LocalPlayer.Character.HumanoidRootPart.Position = game.Workspace.randomparts.teleportpart.Position

Thanks!

2 answers

Log in to vote
1
Answered by 3 years ago

I'm gonna explain this clearly. Use CFrame because it will teleport all of the parts instead of one specific part. Using Position uses Vector3 values, which will obviously kill your character if you try to move it. So using CFrame should do the trick.

game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = workspace.randomparts.teleportpart.CFrame
0
Thanks! LazokkYT 117 — 3y
0
Also, one more tip, it's best to use the function :SetPrimaryPartCFrame because if you don't the script can cause latency problems and issues in the game, it can also create lag which is not what you want. JesseSong 3916 — 3y
0
@JesseSong quick question, what does :SetPrimaryPartCFrame do? Dovydas1118 1495 — 3y
Ad
Log in to vote
1
Answered by 3 years ago

Use CFrame

Example:

game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(X,Y,Z)
0
I wish I could accept 2 answers... Thanks for answering, though! LazokkYT 117 — 3y
0
the cframe is easy warrio5000 0 — 3y

Answer this question