function CheckMobile()if UserInputService.TouchEnabled==true and UseGyroSteering.Value==false then UserInputService.ModalEnabled=true GuiControls.Parent=PlayerGui end end function CheckVR()if UserInputService.VREnabled then UpdateVRPos()if PlayerGui and(PlayerGui:FindFirstChild("\068\105\115\112\108\097\121\071\117\105")and PlayerGui:FindFirstChild("\067\111\108\111\114\071\117\105"))then(PlayerGui:FindFirstChild("\068\105\115\112\108\097\121\071\117\105")).Enabled=false;(PlayerGui:FindFirstChild("\067\111\108\111\114\071\117\105")).Enabled=false end UpdateCharTrans(1,0)end end UserInputService.InputEnded:connect(function(s)if WeldObject.Value~=nil then if s.KeyCode==Enum.KeyCode.W or s.KeyCode==Enum.KeyCode.Up or s.KeyCode==Enum.KeyCode.ButtonR2 then if Direction==1 then Direction=0 end end if s.KeyCode==Enum.KeyCode.S or s.KeyCode==Enum.KeyCode.Down or s.KeyCode==Enum.KeyCode.ButtonL2 then if Direction==-1 then Direction=0 end end if s.KeyCode==Enum.KeyCode.D or s.KeyCode==Enum.KeyCode.Right then if Steer==1 then Steer=0 end end if s.KeyCode==Enum.KeyCode.A or s.KeyCode==Enum.KeyCode.Left then if Steer==-1 then Steer=0 end end end end)

function CheckMobile()
	if UserInputService.TouchEnabled == true and UseGyroSteering.Value == false then -- Won't show mobile guis if gyro is enabled
		UserInputService.ModalEnabled = true
		GuiControls.Parent = PlayerGui
	end
end

function CheckVR()
	if UserInputService.VREnabled then
		UpdateVRPos()
		
		-- Hide tool UI using VR
		if PlayerGui and PlayerGui:FindFirstChild("DisplayGui") and PlayerGui:FindFirstChild("ColorGui") then
			PlayerGui:FindFirstChild("DisplayGui").Enabled = false
			PlayerGui:FindFirstChild("ColorGui").Enabled = false
		end
		UpdateCharTrans(1,0)	
	end
end

UserInputService.InputEnded:connect(function(Key)
	if WeldObject.Value ~= nil then
		--Ends Accelerate
		if Key.KeyCode == Enum.KeyCode.W or Key.KeyCode == Enum.KeyCode.Up or Key.KeyCode == Enum.KeyCode.ButtonR2 then
			if Direction == 1 then
			Direction = 0
			end
		end
		if Key.KeyCode == Enum.KeyCode.S or Key.KeyCode == Enum.KeyCode.Down or Key.KeyCode == Enum.KeyCode.ButtonL2 then
			if Direction == -1 then
			Direction = 0
			end
		end
			--Ends Steer
			if Key.KeyCode == Enum.KeyCode.D or Key.KeyCode == Enum.KeyCode.Right then
				if Steer == 1 then
				Steer = 0
				end
			end
			if Key.KeyCode == Enum.KeyCode.A or Key.KeyCode == Enum.KeyCode.Left then
				if Steer == -1 then
				Steer = 0
				end
			end
	end
end)
