local H,o do local f=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")local Z=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")H=f.Event o=Z.Event UserInputService.InputBegan:Connect(function(H,o)if not o and H.UserInputType==Enum.UserInputType.MouseButton2 then f:Fire()end end)UserInputService.InputEnded:Connect(function(H,o)if H.UserInputType==Enum.UserInputType.MouseButton2 then Z:Fire()end end)end local f do local H=2 local o=.1 function f(f)local Z=(math.abs(f)-o)/(1-o)local m=(math.exp(H*Z)-1)/(math.exp(H)-1)return math.sign(f)*math.clamp(m,0,1)end end
-- right mouse button up & down events
local rmbDown, rmbUp
do
	local rmbDownBindable = Instance.new("BindableEvent")
	local rmbUpBindable = Instance.new("BindableEvent")

	rmbDown = rmbDownBindable.Event
	rmbUp = rmbUpBindable.Event

	UserInputService.InputBegan:Connect(function(input, gpe)
		if not gpe and input.UserInputType == Enum.UserInputType.MouseButton2 then
			rmbDownBindable:Fire()
		end
	end)

	UserInputService.InputEnded:Connect(function(input, gpe)
		if input.UserInputType == Enum.UserInputType.MouseButton2 then
			rmbUpBindable:Fire()
		end
	end)
end

local thumbstickCurve
do
	local K_CURVATURE = 2 -- amount of upwards curvature (0 is flat)
	local K_DEADZONE = 0.1 -- deadzone

	function thumbstickCurve(x)
		-- remove sign, apply linear deadzone
		local fDeadzone = (math.abs(x) - K_DEADZONE) / (1 - K_DEADZONE)

		-- apply exponential curve and scale to fit in [0, 1]
		local fCurve = (math.exp(K_CURVATURE * fDeadzone) - 1) / (math.exp(K_CURVATURE) - 1)

		-- reapply sign and clamp
		return math.sign(x) * math.clamp(fCurve, 0, 1)
	end
end
