I need help creating a pivot point into a CFrame, I know that I need the Object space offset but it’s a moving cframe so i need to update every moment and the offset needs to be a constant so I don’t know
This is what I got currently
This is the code (won’t work if the part trying to keep relative it’s moving)
local pivot = workspace.pivottest.CFrame
local offset = pivot:ToObjectSpace(workspace.particletest.CFrame)
while true do
local particle = workspace.particletest
local pivot = workspace.pivottest.CFrame
particle.CFrame = pivot * offset
game:GetService("RunService").Heartbeat:Wait()
end
``
I’m currently using this code to update the part relative but I need to update the offset so I decided to make an CFrameValue to store the offset independent from the part CFrame but still useless
``lua
local found = particlePart:FindFirstChild(“OffsetVal”)
local offsetValue = particlePart:FindFirstChild(“OffsetVal”) or Instance.new(“CFrameValue”)
offsetValue.Parent = particlePart
offsetValue.Name = "OffsetVal"
if found then
offsetValue.Value = offsetValue.Value + (heartbeatSpeed + offset)
else -- First found
offsetValue.Value = particlePart.CFrame
end
local relativeOffset = particleInfo.Emitter.CFrame:ToObjectSpace(offsetValue.Value)
particlePart.CFrame = particleInfo.Emitter.CFrame * relativeOffset
I fixed by updating the offset value after the particle CFrame.