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

How To Make Rig Teleport And Face A Certain Direction?

Asked by 1 year ago

i want a script where it makes the rig moves to a part and faces the direction of that part

0
Use CFrame xInfinityBear 1777 — 1y
0
CFrame the humanoidRootPart of the player to a part Fouxelefr 7 — 1y

2 answers

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

use CFrame you can use the look vector function then inputting the vector to the look vector, to make it look at a part do

part.CFrame.LookVector  = playercharacter.Head.Vector3

to make it continously look at a part do

while true do
    parthere.CFrame.LookVector = playercharacter.Head.Vector3
    wait(0.01)
end

though if it causes lag change the wait time

Ad
Log in to vote
0
Answered by 1 year ago

This is not a request site, but I'll help you out.

You can teleport a rig by setting the CFrame of the rig's PrimaryPart (usually the HumanoidRootPart or Head)

You can make the rig face the part by using CFrame.lookAt()

part = workspace:WaitForChild("Part") -- change this to your Part
rig = workspace:WaitForChild("R6") -- change this to your rig

-- teleport
rig.PrimaryPart.CFrame = part.CFrame

-- turn
rig.PrimaryPart.CFrame = CFrame.lookAt(rig.PrimaryPart.Position, Vector3.new(part.Position.X, rig.PrimaryPart.Position.Y, part.Position.Z)

I typed everything on mobile so let me know if there's any errors

Answer this question