local c=false local X=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local D=0 local Q=0 local F=0 local u=0 local t=0 local y=0 local j=0 local a=0 local l=0 local A=0 local G=0 function DealWithInput(X,w)if c then if X.KeyCode==Enum.KeyCode.ButtonX then if X.UserInputState==Enum.UserInputState.Begin then y=1 elseif X.UserInputState==Enum.UserInputState.End then y=0 end elseif X.KeyCode==Enum.KeyCode.ButtonY then if X.UserInputState==Enum.UserInputState.Begin then j=1 elseif X.UserInputState==Enum.UserInputState.End then j=0 end elseif X.KeyCode==Enum.KeyCode.ButtonL1 then if X.UserInputState==Enum.UserInputState.Begin then a=1 elseif X.UserInputState==Enum.UserInputState.End then a=0 end elseif X.KeyCode==Enum.KeyCode.ButtonR1 then if X.UserInputState==Enum.UserInputState.Begin then l=1 elseif X.UserInputState==Enum.UserInputState.End then l=0 end elseif X.KeyCode==Enum.KeyCode.DPadUp then if X.UserInputState==Enum.UserInputState.Begin then G=1 elseif X.UserInputState==Enum.UserInputState.End then G=0 end elseif X.KeyCode==Enum.KeyCode.ButtonR3 then if X.UserInputState==Enum.UserInputState.Begin then A=1 elseif X.UserInputState==Enum.UserInputState.End then A=0 end end if X.UserInputType.Name:find("\071\097\109\101\112\097\100")then if X.KeyCode==Enum.KeyCode.Thumbstick1 then D=X.Position.X elseif X.KeyCode==Enum.KeyCode.Thumbstick2 then Q=X.Position.X F=X.Position.Y elseif X.KeyCode==Enum.KeyCode.ButtonR2 then u=X.Position.Z elseif X.KeyCode==Enum.KeyCode.ButtonL2 then t=X.Position.Z end end end end X.InputBegan:connect(DealWithInput)X.InputChanged:connect(DealWithInput)X.InputEnded:connect(DealWithInput)

local Controller=false
local UserInputService = game:GetService("UserInputService")
local LStickX = 0
local RStickX = 0
local RStickY = 0
local RTriggerValue = 0
local LTriggerValue = 0

local ButtonX = 0
local ButtonY = 0
local ButtonL1 = 0
local ButtonR1 = 0
local ButtonR3 = 0
local DPadUp = 0
function DealWithInput(input,IsRobloxFunction)
	if Controller then
		if input.KeyCode ==Enum.KeyCode.ButtonX then
			if input.UserInputState == Enum.UserInputState.Begin then
				ButtonX=1
			elseif input.UserInputState == Enum.UserInputState.End then
				ButtonX=0
			end
		elseif input.KeyCode ==Enum.KeyCode.ButtonY then
			if input.UserInputState == Enum.UserInputState.Begin then
				ButtonY=1
			elseif input.UserInputState == Enum.UserInputState.End then
				ButtonY=0
			end
		elseif input.KeyCode ==Enum.KeyCode.ButtonL1 then
			if input.UserInputState == Enum.UserInputState.Begin then
				ButtonL1=1
			elseif input.UserInputState == Enum.UserInputState.End then
				ButtonL1=0
			end
		elseif input.KeyCode ==Enum.KeyCode.ButtonR1 then
			if input.UserInputState == Enum.UserInputState.Begin then
				ButtonR1=1
			elseif input.UserInputState == Enum.UserInputState.End then
				ButtonR1=0
			end
		elseif input.KeyCode ==Enum.KeyCode.DPadUp then
			if input.UserInputState == Enum.UserInputState.Begin then
				DPadUp=1
			elseif input.UserInputState == Enum.UserInputState.End then
				DPadUp=0
			end
		elseif input.KeyCode ==Enum.KeyCode.ButtonR3 then
			if input.UserInputState == Enum.UserInputState.Begin then
				ButtonR3=1
			elseif input.UserInputState == Enum.UserInputState.End then
				ButtonR3=0
			end
		end
		if input.UserInputType.Name:find("Gamepad") then --it's one of 4 gamepads
			if input.KeyCode == Enum.KeyCode.Thumbstick1 then
				LStickX = input.Position.X
			elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then
				RStickX = input.Position.X
				RStickY = input.Position.Y
			elseif input.KeyCode == Enum.KeyCode.ButtonR2 then--right shoulder
				RTriggerValue = input.Position.Z
			elseif input.KeyCode == Enum.KeyCode.ButtonL2 then--left shoulder
				LTriggerValue = input.Position.Z
			end
		end
	end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)--keyboards don't activate with Changed, only Begin and Ended. idk if digital controller buttons do too
UserInputService.InputEnded:connect(DealWithInput)