local d,x do local z=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")local q=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")d=z.Event x=q.Event UserInputService.InputBegan:Connect(function(d,x)if not x and d.UserInputType==Enum.UserInputType.MouseButton2 then z:Fire()end end)UserInputService.InputEnded:Connect(function(d,x)if d.UserInputType==Enum.UserInputType.MouseButton2 then q:Fire()end end)end local z do local d=2 local x=.1 function z(z)local q=(math.abs(z)-x)/(1-x)local N=(math.exp(d*q)-1)/(math.exp(d)-1)return math.sign(z)*math.clamp(N,0,1)end end

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
