local H=plr.Character.HumanoidRootPart local S,h=script.Parent.Vel,script.Parent.PVel local i=Vector3.new(sens,sens,sens)local D=0 local C=0 local M=1 local J=-90 J=math.rad(J)function Rotate()local S=H.CFrame.lookVector local h=math.atan2(S.z,S.x)if h<-1.57 and C>1.57 then D=D-math.pi*2 elseif h>1.57 and C<-1.57 then D=D+math.pi*2 end D=D*(1-M)+h*M local i=D+J C=h script.Parent.F.Rotation=-math.deg(i)end while true do S.Value=H.Velocity wait()h.Value=S.Value S.Value=H.Velocity local D=script.Parent.Diff D.Value=(h.Value-S.Value)*i local C=D.Value.X/4 C=math.min(C,.5)C=math.max(C,-0.5)local M=D.Value.Z/4 M=math.min(M,.5)M=math.max(M,-0.5)Rotate()script.Parent.F.Dot.Position=UDim2.new(-C+.5,-8,-M+.5,-8)local J=(Vector2.new(D.Value.X/2,D.Value.Z/2)).Magnitude if J<min then J=0 end script.Parent.TL.Text=math.floor(math.min(J,max)*100)/100 .." \071"end


local target = plr.Character.HumanoidRootPart

local vel,pvel = script.Parent.Vel , script.Parent.PVel

local sensitivity = Vector3.new(sens,sens,sens)

local slurAngle = 0
local previousDesiredAngle = 0
local spinSpeed = 1 --ratio per second
local rotationOffset = -90 --in degrees
rotationOffset = math.rad(rotationOffset)

function Rotate()
	local vec = target.CFrame.lookVector
	local desiredAngle = math.atan2(vec.z, vec.x)
	if desiredAngle < -1.57 and previousDesiredAngle > 1.57 then
		slurAngle = slurAngle - math.pi*2
	elseif desiredAngle > 1.57 and previousDesiredAngle < -1.57 then
		slurAngle = slurAngle + math.pi*2
	end
	slurAngle = slurAngle*(1-spinSpeed) + desiredAngle*spinSpeed
	local a = slurAngle + rotationOffset
	previousDesiredAngle = desiredAngle
	script.Parent.F.Rotation = -math.deg(a)
end
while true do
	vel.Value = target.Velocity
	wait() --REQUIRED while loop
	pvel.Value = vel.Value
	vel.Value = target.Velocity
	
	local diff = script.Parent.Diff
	diff.Value = ((pvel.Value-vel.Value) * sensitivity)
	
	local xz = ((diff.Value.X)/4)
	xz = math.min(xz,.5) xz = math.max(xz,-.5)
	
	local yz = ((diff.Value.Z)/4)
	yz = math.min(yz,.5) yz = math.max(yz,-.5)
	Rotate()
	script.Parent.F.Dot.Position = UDim2.new(-xz+.5,-8,(-yz)+.5,-8)
	
	local mag = Vector2.new(diff.Value.X/2,diff.Value.Z/2).Magnitude
	if mag < min then mag = 0 end
	script.Parent.TL.Text = math.floor(math.min(mag,max)*100)/100 .. " G"
end
