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

How to keep a part's rotation after CFraming?

Asked by 6 years ago

This is my script

if (hit.HitCount.Value >= 5) then

        local graveyard = CFrame.new(99, -759, -2763) -- The destination it needs to go
        local oldPos = CFrame.new(hit.Position) -- The part's original position
        hit.CFrame = graveyard 

        wait(5)

        hit.HitCount.Value = 0
        hit.CFrame = oldPos -- Returns to it's old position

        end

I want it to go to the destination (graveyard) then return after 5 seconds keeping both it's old position and rotation. But the problem is that CFraming resets the rotation.

I have tried many things that I thought of as I went but none worked. Any help is appreciated, thank you.

0
Just do `oldPos = hit.CFrame` >-> TheeDeathCaster 2368 — 6y
0
Oh wow its that simple? Im stupid why havent I thought of that. Thanks anyways, really appreciate it. xXrawr_xdXxOwO 24 — 6y
0
Np. TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
0
Answered by
GingeyLol 338 Moderation Voter
6 years ago
Edited 6 years ago

You can use Position instead of CFrame, CFrame is Position and Rotation, Position is used with Vector3 like, Object.Position = Vector3.new(X,Y,Z) with XYZ as integers

Ad

Answer this question