local A={[Enum.KeyCode.W]=Vector3.new(0,0,-1);[Enum.KeyCode.A]=Vector3.new(-1,0,0),[Enum.KeyCode.S]=Vector3.new(0,0,1),[Enum.KeyCode.D]=Vector3.new(1,0,0)}local r local t={}function t.GetInput(r)local t=Vector3.new()local B local h=UserInputService:GetKeysPressed()for r,h in pairs(h)do if A[h.KeyCode]then t+=A[h.KeyCode]elseif h.KeyCode==Enum.KeyCode.Space then B=true end end local I=Camera.CFrame local G,R,v=I:ToOrientation()local a=CFrame.Angles(0,R,v)local H=a:VectorToWorldSpace(t)RobloxianController:TellControl(H,B,a.LookVector)end function t.Deactivate(A)r:Destroy()end function t.Activate(A)r._InputCon=RunService.RenderStepped:Connect(function()A:GetInput()end)end function t.Start(A)RobloxianController=A.Controllers.RobloxianController r=A.Shared.Maid.new()end function t.Init(A) end return t
--Variable
local MovementMap = {
	[Enum.KeyCode.W] = Vector3.new(0, 0, -1),
	[Enum.KeyCode.A] = Vector3.new(-1, 0, 0),
	[Enum.KeyCode.S] = Vector3.new(0, 0, 1),
	[Enum.KeyCode.D] = Vector3.new(1, 0, 0),
}

local Maid

local MovementController = {}

function MovementController:GetInput()
	local totalVector = Vector3.new()
	local isJump

	local allKeys = UserInputService:GetKeysPressed()

	for _, key in pairs(allKeys) do
		if MovementMap[key.KeyCode] then
			totalVector += MovementMap[key.KeyCode]
		elseif key.KeyCode == Enum.KeyCode.Space then
			isJump = true
		end
	end

	local CameraCF = Camera.CFrame
	local X, Y, Z = CameraCF:ToOrientation()
	local newCF = CFrame.Angles(0, Y, Z)
	local FinalVector = newCF:VectorToWorldSpace(totalVector)

	RobloxianController:TellControl(FinalVector, isJump, newCF.LookVector)
end

function MovementController:Deactivate()
	Maid:Destroy()
end

function MovementController:Activate()
	Maid._InputCon = RunService.RenderStepped:Connect(function()
		self:GetInput()
	end)
end

function MovementController:Start()
	RobloxianController = self.Controllers.RobloxianController
	Maid = self.Shared.Maid.new()
end

function MovementController:Init() end

return MovementController
