Rotation Similar to the Callisto protocol

so, I want to achieve something like this:


watch how the player turns away from the door rather smoothly.

And this is mines:

And now, this is mines when I start using the WASD keys:

Script:

local camera = workspace.CurrentCamera
local plr = game:GetService("Players").LocalPlayer
local ts = game:GetService("TweenService")
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")

rs.RenderStepped:Connect(function()
	if plr.Character then
		local rtp = plr.Character:FindFirstChild("HumanoidRootPart")
		if rtp then
			local targetCFrame = CFrame.new(rtp.CFrame.p, rtp.CFrame.p + Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z))
			local tweenInfo = TweenInfo.new(0.5)
			ts:Create(rtp, tweenInfo, {CFrame = targetCFrame}):Play()
		end
	end
end)
1 Like