Help with CFrame/Bodymovers

I’m not great when it comes to CFrame related stuff and I’ve got 2 issues as a result.

First riding the dragon is jittery.
Somehow I made it lose its smoothness.
https://gyazo.com/eb67cccd5ef8ae5ac0193b2f5c8b60c6

Client Code

local RS = game:GetService("RunService")
local Event = script.Parent.Remote.Value
local Running = false

script.Parent.AncestryChanged:Connect(function()
	Running = false
end)

Event.OnClientEvent:Connect(function(Mode)
	if Mode == "Run" and Running ~= true then
		Running = true
		while Running == true do
			RS.Heartbeat:Wait()
			local DirCF = game.Workspace.CurrentCamera.CFrame 
			Event:FireServer(DirCF)
		end
	elseif Mode == "Stop" then
		Running = false
	end
end)

game:GetService("UserInputService").InputBegan:Connect(function(obj, gpe)
	if not gpe then
		if obj.KeyCode then
			if obj.KeyCode == Enum.KeyCode.Q then
				Event:FireServer(nil, "Q")
			elseif obj.KeyCode == Enum.KeyCode.G then
				Event:FireServer(nil, "G")
			elseif obj.KeyCode == Enum.KeyCode.H then
				Event:FireServer(nil, "H")
			end
		end
	end
end)

Direction Event on Server

DirectionEvent = Services.Event.OnServerEvent:Connect(function(Player, Dir, Key)
						if not Key then
							if Player == P and OUI:FindFirstChild("MainFrame") and OUI.MainFrame.Fly.Text ~= "FLY (G)" then
								if OUI.MainFrame.Dash.Text ~= "DASH (Q)" then
									BV.Velocity = S.CFrame.lookVector * 50
								else
									BV.Velocity = Vector3.new(0, 0, 0)
								end
								if Dir.LookVector then
									BG.CFrame = Dir
									--BG.CFrame = CFrame.new(S.Position, S.Position + Vector3.new(Dir.LookVector.X, Dir.LookVector.Y, Dir.LookVector.Z))
								end
							end
						else
							if Key == "H" then
								Loader.Attack:FireBreath(Loader, Services, Dragon, Animation.LookBack, DM, Animation.Breath, StopMode, OUI, P, C)
							elseif Key == "Q" then
								Loader.Control:Dash(Loader, Services, Animation.LookBack, OUI, Animation.IdleFly, Animation.Fly, BV, DM, Dragon, BG)
							elseif Key == "G" then
								Loader.Control:Fly(Loader, Services, Animation.LookBack, OUI, Dragon, DM, DragonCollision, DragonBottom, BV, P, Animation.Fly, Animation.IdleFly, Animation.Idle, Animation.Liftoff, BG, C, Animation.Breath, StopMode)
							end
						end
					end)

Then my landing is just a mess
https://gyazo.com/d7f49c81bb60fc9fadf1163b268cbcfe

Landing Server

function module:Land(Loader, Services, C, Fly, Liftoff, IdleFly, BV, D, OUI, DragonCollision, DragonBottom, BG, DM, P, Idle)
	Fly:Stop()
	Liftoff:Stop()
	IdleFly:Play() 
	BV.Velocity = Vector3.new(0, -50, 0)
	BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	BV.P = math.huge

	local Landed = false
	while task.wait(.1) do
		if D:FindFirstChild("HP") and D.HP.Value > 0 then
			if OUI:FindFirstChild("MainFrame") and OUI.MainFrame.Fly.Text ~= "FLY (G)" then
				break
			end
		end
		BV.Velocity = Vector3.new(0, -50, 0)
		DragonCollision.Massless = false
		DragonBottom.Massless = false
		for _,v in pairs(DragonBottom:GetTouchingParts()) do
			if not v:IsDescendantOf(D) and not v.Parent:FindFirstChildOfClass("Humanoid") and not v.Parent.Parent:FindFirstChildOfClass("Humanoid") then
				-- assumed landed
				IdleFly:Stop() 
				task.wait(.2)
				BV.MaxForce = Vector3.new(50, 50, 50)
				BV.P = 5000
				BG.MaxTorque = Vector3.new(0, 0, 0)
				BG.P = 100
				Idle:Play()
				if P then
					Services.Event:FireClient(P, "Stop")
				end
				task.wait(1)
				DM.Anchored = true
				if D:FindFirstChild("DragonSeat") then D.DragonSeat.Anchored = true end
				print'landed'
				if D.HP.Value <= 0 then
					D:Destroy()
				end
				Landed = true
				D.Flying.Value = false
			end
		end
		if Landed then
			break
		end
	end
end

Sorry just learned how to upload the video here. This is the jitteryness from flying.

This is the janky landing.

I’ve also considered using the replacement for Body movers since they’re deprecated but when I initially tried them they had a lot of issues which I’m not sure have been addressed or not. Thanks.

The gittering s simply from Heartbeat:Wait() being too long. A more smooth transition would be with .RenderStepped:Wait() instead.

However a better solution, and probably more efficient would be to allow the client to move the model and have those changes directly replicate to the server. Basically you can set network owner to the player instance which will allow any changes made on the client by a local script replicate to the server.

Using the bodymover is supposed to make the movement feel smoother and only works on the server. I can’t use RenderStepped on the server but I could consider using the client for movement instead. However, I don’t believe the jitteriness of it comes from it being on the server because vehicles for years have been done on the server just fine.

If I were trying to make a larger game where I’d have to be picky about rendering I’d probably agree that doing movement through the client would be best so I could filter unneeded animations at a distance. Although there are a lot of vulnerabilities having everything laid out and trusted on the client with limited involvement from the server.

Also suddenly the problem just doesn’t exist anymore…

Ah roblox…
the landing issue still exists though.

might aswell do a cframe animation for the landing

So swap between client and server? I feel like there’s a better way to go about it, no?

i dont know, thought id give out an idea

Still having issues with landing and the jittering doesnt come up often but in rare occasions it also happens. Would this be fixed if I changed to the new movement tools or is this an issue with how I coded it?

Thanks.

The jitter now happens again every time with no changes made to the script. I changed the environment around and it began to jitter again. It’s strange because the other basic dragon script I have works smoothly but it doesn’t follow the camera to steer so I feel it must be related to the BodyGyro or how the BodyVelocity interacts with it.