--	local CKey = { KeyStates[KeyMap.Flip.PrimaryKey] or KeyStates[KeyMap.Flip.SecondaryKey] }
--	if CKey then
--		Input.Flip = 0
--	else
--		Input.Flip = 1
--	end

end
	
UIS.InputBegan:Connect(function(InputObj)
	--if InputObj.UserInputType == Enum.UserInputType.Keyboard then
		KeyStates[InputObj.KeyCode] = true
		KeyChanged()
	--end
end)

UIS.InputEnded:Connect(function(InputObj)
	--if InputObj.UserInputType == Enum.UserInputType.Keyboard then
		KeyStates[InputObj.KeyCode] = false
		KeyChanged()
	--end
end)

UIS.InputChanged:Connect(function(InputObj)
	if Input.InputMode == "Gamepad" then --Search for gamepad input
		if UIS.GamepadEnabled then
			local State = UIS:GetGamepadState(Enum.UserInputType.Gamepad1)
			local Stick1 = 0
			local RT1 = 0
			local LT1 = 0
			for i,v in pairs(State) do
				if v.KeyCode == Enum.KeyCode.ButtonR2 then
					RT1 = v.Position
				elseif v.KeyCode == Enum.KeyCode.ButtonL2 then
					LT1 = v.Position
				elseif v.KeyCode == Enum.KeyCode.Thumbstick1 then
					Stick1 = v.Position
					--if math.abs(Stick1)<0.18 then Stick1 = 0 else
					--	Stick1 = 1.18*Stick1 - 0.18*math.sign(Stick1)
					--end
				end
			end
			Input.Triggers = RT1.Z - LT1.Z
			Input.LStickY = Stick1.Y
			Input.LStickX = -Stick1.X
		end
	end
end)
		
return Input
