local Players = game:GetService("Players") local RunService = game:GetService("RunService") local ContextActionService = game:GetService("ContextActionService") local Player = Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Jumping = false local LeftValue, RightValue = 0, 0 local function Left(ActionName, InputState) if InputState == Enum.UserInputState.Begin then LeftValue = 1 elseif InputState == Enum.UserInputState.End then LeftValue = 0 end end local function Right(ActionName, InputState) if InputState == Enum.UserInputState.Begin then RightValue = 1 elseif InputState == Enum.UserInputState.End then RightValue = 0 end end local function Jump(ActionName, InputState) if InputState == Enum.UserInputState.Begin then Jumping = true elseif InputState == Enum.UserInputState.End then Jumping = false end end local function Update() if Character and Character:FindFirstChild("Humanoid") then if Jumping then Character.Humanoid.Jump = true end local MoveDirection = RightValue - LeftValue Character.Humanoid:Move(Vector3.new(MoveDirection, 0, 0), false) end end RunService:BindToRenderStep("Control", Enum.RenderPriority.Input.Value, Update) ContextActionService:BindAction("Left", Left, true, "a", Enum.KeyCode.Left, Enum.KeyCode.DPadLeft) ContextActionService:BindAction("Right", Right, true, "d", Enum.KeyCode.Right, Enum.KeyCode.DPadRight) ContextActionService:BindAction("Jump", Jump, true, "w", Enum.KeyCode.Space, Enum.KeyCode.Up, Enum.KeyCode.DPadUp, Enum.KeyCode.ButtonA)