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

is this the right way to offset CFrames because its not working?

Asked by 5 years ago

so this code is meant to copy the CFrame of another object and be 10 studs offsetted in the Y axis when it applies it to another object but when i run the code nothing happens. Can someone please tell me what i'm doing wrong here. This is inside a repeat loop btw

LLleg.CFrame = Lfoot.CFrame.new(0,10,0)

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Hi Waffle_Blox,

That's not the correct way to offset CFrame because all you did was set it to a new CFrame. You multiply CFrames, and therefore you need to multiply the original CFrame by the new CFrame. Like this:

LLleg.CFrame = LLleg.CFrame * CFrame.new(0,10,0) -- Offsets the CFrame by positive 10 studs.

Also, I noticed you were using Lfoot.CFrame, instead of the LLleg’s CFrame. If you want to offset something, then you need to use its own CFrame because think of it as changing the object relative to its own position/adding to the object’s CFrame.

Well, hope I was of help and good luck!

Thanks, Best regards, IdealistDeveloper

0
thanks it helped alot Waffle_Blox 3 — 5y
0
Glad to be of service. IdealistDeveloper 234 — 5y
Ad

Answer this question