local p=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local E=0 local u=0 local z=0 local a=0 local X=0 stdz=script.Value local F={[Enum.KeyCode.ButtonL1]={f=function()if control.Value=="\067\111\110\116\114\111\108\108\101\114"then if script.Parent.Storage.CurrentGear.Value~=1 then script.Parent.Functions.ShiftDownRequested.Value=true end print("\068\079\087\078")end end,deb=false},[Enum.KeyCode.ButtonR1]={f=function()if control.Value=="\067\111\110\116\114\111\108\108\101\114"then if script.Parent.Storage.CurrentGear.Value~=script.Parent.Storage.AmountOfGears.Value+2 then script.Parent.Functions.ShiftUpRequested.Value=true end print("\085\080")end end;deb=false}}function DealWithInput(p,E)if p.UserInputType==Enum.UserInputType.Keyboard then local E=carSeat.Velocity.magnitude if p.KeyCode==Enum.KeyCode.A then if p.UserInputState==Enum.UserInputState.Begin then elseif p.UserInputState==Enum.UserInputState.End then end end if p.KeyCode==Enum.KeyCode.D then if p.UserInputState==Enum.UserInputState.Begin then elseif p.UserInputState==Enum.UserInputState.End then end end if p.KeyCode==Enum.KeyCode.W then if p.UserInputState==Enum.UserInputState.Begin then elseif p.UserInputState==Enum.UserInputState.End then end end if p.KeyCode==Enum.KeyCode.S then if p.UserInputState==Enum.UserInputState.Begin then elseif p.UserInputState==Enum.UserInputState.End then end end end if p.KeyCode==Enum.KeyCode.ButtonX then if p.UserInputState==Enum.UserInputState.Begin then print("\104\101\108\112 \109\101 \115\111\110\110\121")elseif p.UserInputState==Enum.UserInputState.End then end end if control.Value=="\075\101\121\098\111\097\114\100"then local p=math.max(1,(mouse.ViewSizeX*67)/200)local E=.04 local u=(mouse.X-mouse.ViewSizeX/2)/p if math.abs(u)<=E then Gval=0 else Gval=(math.max(math.min(math.abs(u)-E,1-E),0)/(1-E))^1*(u/math.abs(u))end end if control.Value=="\067\111\110\116\114\111\108\108\101\114"then if p.UserInputType.Name:find("\071\097\109\101\112\097\100")then if p.KeyCode==Enum.KeyCode.Thumbstick1 then if p.Position.X>stdz.Value then if script.Parent.Storage.Control.Value=="\067\111\110\116\114\111\108\108\101\114"then script.Parent.Storage.Steer.Value=(p.Position.X-stdz.Value)*(1/(1-stdz.Value))end elseif p.Position.X<-stdz.Value then if script.Parent.Storage.Control.Value=="\067\111\110\116\114\111\108\108\101\114"then script.Parent.Storage.Steer.Value=(p.Position.X+stdz.Value)*(1/(1-stdz.Value))end else script.Parent.Storage.Steer.Value=0 end elseif p.KeyCode==Enum.KeyCode.ButtonR2 then a=p.Position.Z script.Parent.Storage.Throttle.Throttle.Value=a elseif p.KeyCode==Enum.KeyCode.ButtonL2 then X=p.Position.Z script.Parent.Storage.Brake.Value=X elseif F[p.KeyCode]then local E=F[p.KeyCode]if p.Position.Z>.5 and not E.deb then E.deb=true E.f()elseif p.Position.Z<.5 then E.deb=false end end end end end p.InputBegan:connect(DealWithInput)p.InputChanged:connect(DealWithInput)p.InputEnded:connect(DealWithInput)
--//Misc2//--
local UserInputService = game:GetService("UserInputService")

local steer = 0
local throttle = 0
local brake = 0

local RTriggerValue = 0
local LTriggerValue = 0

stdz = script.Value

local PositiveEdgeButton = {
	[Enum.KeyCode.ButtonL1] = {
		f = function()
			if control.Value == "Controller" then
				if script.Parent.Storage.CurrentGear.Value ~= 1 then
					script.Parent.Functions.ShiftDownRequested.Value = true
				end
				print("DOWN") --ADD LOWER LIMIT [AND UPPER 4 OTHER 1]
			end
		end,
		deb = false,
	},

	[Enum.KeyCode.ButtonR1] = {
		f = function()
			if control.Value == "Controller" then
				if script.Parent.Storage.CurrentGear.Value ~= script.Parent.Storage.AmountOfGears.Value + 2 then
					script.Parent.Functions.ShiftUpRequested.Value = true
				end
				print("UP")
			end
		end,
		deb = false,
	},
}

function DealWithInput(input, IsRobloxFunction)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		local speed = carSeat.Velocity.magnitude
		if input.KeyCode == Enum.KeyCode.A then
			if input.UserInputState == Enum.UserInputState.Begin then
			elseif input.UserInputState == Enum.UserInputState.End then
			end
		end
		if input.KeyCode == Enum.KeyCode.D then
			if input.UserInputState == Enum.UserInputState.Begin then
			elseif input.UserInputState == Enum.UserInputState.End then
			end
		end
		if input.KeyCode == Enum.KeyCode.W then
			if input.UserInputState == Enum.UserInputState.Begin then
			elseif input.UserInputState == Enum.UserInputState.End then
			end
		end
		if input.KeyCode == Enum.KeyCode.S then
			if input.UserInputState == Enum.UserInputState.Begin then
			elseif input.UserInputState == Enum.UserInputState.End then
			end
		end
	end

	if input.KeyCode == Enum.KeyCode.ButtonX then
		if input.UserInputState == Enum.UserInputState.Begin then
			print("help me sonny")
		elseif input.UserInputState == Enum.UserInputState.End then
		end
	end

	if control.Value == "Keyboard" then
		local LRpix = math.max(1, mouse.ViewSizeX * 67 / 200)
		local dZoe = 0.04
		local MousePx = ((mouse.X - mouse.ViewSizeX / 2) / LRpix) --print(MousePx)
		if math.abs(MousePx) <= dZoe then
			Gval = 0
		else
			Gval = (math.max(math.min((math.abs(MousePx) - dZoe), (1 - dZoe)), 0) / (1 - dZoe)) ^ 1
				* (MousePx / math.abs(MousePx))
		end

		--add if here
		---mouse.Button1Down:connect(function()
		---print("LeftClick")
		---end)

		---mouse.Button2Down:connect(function()
		---print("RightClick")
		--end)
	end

	if control.Value == "Controller" then
		if input.UserInputType.Name:find("Gamepad") then
			--------
			if input.KeyCode == Enum.KeyCode.Thumbstick1 then
				if input.Position.X > stdz.Value then
					if script.Parent.Storage.Control.Value == "Controller" then
						script.Parent.Storage.Steer.Value = ((input.Position.X - stdz.Value) * (1 / (1 - stdz.Value)))
					end
				elseif input.Position.X < -stdz.Value then
					if script.Parent.Storage.Control.Value == "Controller" then
						script.Parent.Storage.Steer.Value = ((input.Position.X + stdz.Value) * (1 / (1 - stdz.Value)))
					end
				else
					script.Parent.Storage.Steer.Value = 0
				end
			elseif input.KeyCode == Enum.KeyCode.ButtonR2 then
				RTriggerValue = input.Position.Z
				script.Parent.Storage.Throttle.Throttle.Value = RTriggerValue
			elseif input.KeyCode == Enum.KeyCode.ButtonL2 then
				LTriggerValue = input.Position.Z
				script.Parent.Storage.Brake.Value = LTriggerValue
			elseif PositiveEdgeButton[input.KeyCode] then
				local fn = PositiveEdgeButton[input.KeyCode]
				if input.Position.Z > 0.5 and not fn.deb then
					fn.deb = true
					fn.f()
				elseif input.Position.Z < 0.5 then
					fn.deb = false
				end
			end
		end
	end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
