I was wondering how to make a CFrame in movement relative to another CFrame, like the ParticleEmitter LockedToPart property.
This is an example of my movement code
local origin = Part
local projectile = Part2
runService.Heartbeat:Connect(function(delta)
projectile.CFrame += origin.CFrame.LookVector
-- If the origin moves or rotates, the projectile won't be relative to it.
end)
From what I understood you want to create a particle-like system? Or are you trying to make something like a weapon.
Well, if you want to change a part’s CFrame relative to another, all you have to do is multiply this new part’s CFrame by the CFrame of the Origin Part
local origin = Part
local projectile = Part2
local tween = game:GetService("TweenService")
runService.HeartBeat:Connect(function()
local move = tween:Create(projectile, TweenInfo.new(.15), {
CFrame = origin.CFrame * CFrame.new(5, 0, 0)
})
move:Play()
move.Completed:Wait()
end)
If I typed that properly, this will make it so the projectile part constantly moves 5 studs forward in comparison to the origin part’s CFrame, if it doesn’t work like I described, you can mess around with the CFrame.new() values so you can understand the concept and execute it to your own liking.