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

How would I convert these bodymovers into CFrames?

		local bodyForce = Instance.new('BodyForce', part)
		bodyForce.Name = 'Antigravity'
		bodyForce.force = Vector3.new(0, part:GetMass() * 196.8, 0)

		local spawnPosition = (handle.CFrame * CFrame.new(2, 0, 0)).p
		part.CFrame = CFrame.new(spawnPosition, mouse.Hit.p) 
	
		part.Velocity = part.CFrame.lookVector * bulletvelocity
		part.Parent = workspace
		

So I made a bullet script, but it uses Bodymovers. And as you can tell, these lag. A lot. So my question is, how would I convert this into CFrame to make it less laggy>?

1 answer

✓ Accepted answer

By convert to CFrame, do you mean keep the part anchored and just use cframe to move it? If that's the case, then this is your answer.

local spawnCFrame = (handle.CFrame * CFrame.new(2, 0, 0)) 
local cframe  = CFrame.new(mouse.Hit.p)  -- CFrame of mouse
part.Parent = workspace
part.Position = spawnCFrame.p -- Position the part to the spawncframe
for i = 0,1,.1 do --Put in your increment
	part.CFrame = spawnCFrame:lerp(cframe,i) -- Will tween the part to the cframe with i as the fraction alpha
	wait()
end

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