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

Add a direction to: SetPrimaryPartCFrame?

Here is what I did

Template:SetPrimaryPartCFrame(CFrame.new(Vector3.new(X_Pos, Y_Pos, Z_Pos + Size)))

Did not work either:

Template:SetPrimaryPartCFrame(CFrame.new(X_Pos, Y_Pos, Z_Pos + Size))

The template whose CFrame is changed no longer has its orientation when the primarypart CFrame is changed

How to fix this?

2 comments

0

u dont use the CFrame.new() constructor 

0

set the cframe instead

1 answer

✓ Accepted answer

The orientation data is lost because you are only passing in the positional components of the CFrame. In order to fix this, you can save the orientation to a separate variable and apply it to the new CFrame instead.

local orientation = Template.PrimaryPart.CFrame - Template.PrimaryPart.CFrame.Position

Template:SetPrimaryPartCFrame(CFrame.new(X_Pos, Y_Pos, Z_Pos + Size) * orientation) --order of multiplication is important

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