Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to keep a part's rotation after CFraming?

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.

3 comments

0

Just do oldPos = hit.CFrame >->

0

Oh wow its that simple? Im stupid why havent I thought of that. Thanks anyways, really appreciate it.

0

Np.

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.